com.unity.cloud.gltfast icon indicating copy to clipboard operation
com.unity.cloud.gltfast copied to clipboard

Adds safety checks for bad animation data

Open timokorkalainen opened this issue 1 year ago • 1 comments

Some optimized GLB files can contain animation data that causes a null reference exception here. This PR adds a safety check for that that causing issues.

timokorkalainen avatar May 16 '24 22:05 timokorkalainen

CLA assistant check
All committers have signed the CLA.

unity-cla-assistant avatar May 16 '24 22:05 unity-cla-assistant

@timokorkalainen Thanks for the contribution.

Could you provide examples/glTFs that trigger the error?

While defensive coding (with check like yours) is good in general, I want to make sure we're not hiding potential problems and make them hard to find. If there's a problem with our code, we should fix it. If there's a problem with the input/glTF, we should report/log it.

atteneder avatar Aug 22 '24 13:08 atteneder

I've done my own attempt of achieving more resilience in this particular part of the code base, therefore closing this pull request.

The upside is that now there's either a proper error message/log when the glTF is invalid or a runtime error (assertion) when there are internal inconsistencies.

Again, thanks for the work!

atteneder avatar Sep 02 '24 12:09 atteneder

@timokorkalainen Thanks for sending me a test file on another channel.

TIL that if an accessor's bufferView is not set, it is still valid and its values should get initialized with zeroes.

Therefor the initial PR would indeed have masked the actual problem, which is now tracked in #24.

atteneder avatar Oct 14 '24 11:10 atteneder