hai-vr / av3-animator-as-code

Generate animator layers and animations from a fluent builder syntax. Initially designed for use in VRChat, this is now a generic package that does not require it.
https://docs.hai-vr.dev/docs/products/animator-as-code
MIT License
188 stars 14 forks source link

Fix nullref on subAsset check when clearing previous assets #27

Open yewnyx opened 2 years ago

yewnyx commented 2 years ago

subAsset can be null for some strange reason, so do the type checks on subAsset (which all fail 'null') before accessing subAsset.name

hai-vr commented 2 years ago

The asset container is supposed to be created by Animator As Code, with its integrity under the ownership of Animator As Code.

Due to this, the container must only return non-null objects after invocation of this method, this is an invariant.

An implicit null check is not the correct solution here.

What operations did you perform on the asset container prior to this issue occuring?

yewnyx commented 2 years ago

I cleared out the contents of my FX animator controller, as I intended to move it over to AAC.

If there is an indication in the documentation that AAC owns the asset container, it doesn't seem clear to me, but armed with that understanding, it's much clearer to see after the fact. However, I am still somewhat lost as to where AAC is supposed to create the asset container - the examples throw ArgumentNullExceptions unless one is created and provided to them.