Spaces:
Paused
Paused
Fix: TalkingHead2.animate crash - null morph target access in animate()
#5
by bep40 - opened
Fix: TalklingHead2.animate crash "Cannot read properties of undefined (reading 'value')"
Root cause
In @met4citizen/talkinghead/dist/talkinghead.mjs, the animate() method crashes at line ~2620 when:
this.mtRandomizedcontains morph target keys not present inthis.mtAvatarfor the loaded GLBj = this.mtAvatar[i]returns undefined โ!j.needsUpdatethrows
Fix (3 layers)
- Null check in animate โ add
if (!j) continue;before null access - Guard direct .value accesses โ wrap
this.mtAvatar['key'].valuein(this.mtAvatar['key'] || {}).value || 0 - Wrap animate in try/catch โ safety net for any other crashes
Patch is applied at Docker build-time via patch_talkinghead.py run after bun install.