etriebe / combat-estimate

MIT License
4 stars 1 forks source link

Most creatures don't work - error reading 'match' #15

Closed Zamrod closed 2 years ago

Zamrod commented 2 years ago

Trying to use the module and almost any combination of creatures I try gives me a blank list of friendly and hostile combatants and the following error in the console:

ActorUtils.js:919 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'match')
    at ActorUtils.getDamageWithResistance (ActorUtils.js:919:37)
    at ActorUtils.getInfoForAttackObject (ActorUtils.js:1048:47)
    at CombatEstimateDialog.getActorCombatSummary (dialog.js:154:18)
    at CombatEstimateDialog.populateCombatants (dialog.js:91:33)
    at CombatEstimateDialog.activateListeners (dialog.js:37:8)
    at CombatEstimateDialog._render (foundry.js:3090:10)
    at async CombatEstimateDialog._render (foundry.js:3764:5)
Zamrod commented 2 years ago

It does work with some combinations of monsters. I added one PC and this Polar Bear and it caused the error. Attaching the json for reference.

fvtt-Actor-polar-bear.txt

Zamrod commented 2 years ago

After some further investigation the cause appears to be attempting to match on enemyTraitsObject.dr.custom and enemyTraitsObject.di.custom when those values are null. If you add an if statement checking if they are null before attempting to the do the match, it works fine. There are 4 incidents of this in ActorUtils.js

etriebe commented 2 years ago

Thanks for the report and investigation! I should be able to fix tonight.

etriebe commented 2 years ago

Fixed with this release.

https://github.com/etriebe/combat-estimate/releases/tag/1.0.22