espositos / fvtt-tokenactionhud

Creating a token action HUD module for Foundry VTT
31 stars 38 forks source link

Cannot read property 'id' of undefined #284

Closed thatlonelybugbear closed 3 years ago

thatlonelybugbear commented 3 years ago

After last update to 1.1.2 with all other modules disabled (Foundry 0.8.7, DnD5e-1.3.5)

Whenever I move a token around this error triggers but with no other problem that I could see:


TypeError: Cannot read property 'id' of undefined
    at TokenActionHUD.getTokenId (tokenactionhud.js:417)
    at tokenactionhud.js:413
    at Array.some (<anonymous>)
    at TokenActionHUD.isRelevantToken (tokenactionhud.js:413)
    at TokenActionHUD.validTokenChange (tokenactionhud.js:406)
    at init.js:40
    at Function._call (foundry.js:194)
    at Function.callAll (foundry.js:153)
    at ClientDatabaseBackend.callback (foundry.js:8880)
    at foundry.js:8850```
Oshcakes commented 3 years ago

I am seeing the same issue as well. Each time the token is moved it generates an error. This is hosted on the forge if that matters. Other module enabled is TidyUI image

jessev14 commented 3 years ago

I believe this issue can be fixed with the following change to line 413 of tokenactionhud.js:

return controlled?.some(t => t.id === this.getTokenId(token)) || (controlled?.length === 0 && canvas?.tokens?.placeables?.some(t => t.id === this.targetActions?.tokenId));
espositos commented 3 years ago

I will add jessev14's cpde but let me know if the issue persists

espositos commented 3 years ago

don't really know how this went unspotted for so long given how i had fucked up that line