Can't add extra damage block to Damage effect without actor

Issue #293 resolved
Ben Freeland created an issue

Setup

Foundry: 0.8.9
dnd5e: 1.4.3
obsidian: 5.0.19

Steps to Reproduce

  1. Create Feature item
  2. Create effect and add Damage effect
  3. Select the Damage effect and click Add Bonus

Expected

Extra damage block is added to bottom of damage effect

Observed

No extra damage block is added and the following error is printed in the console:

bonuses.js:194 Uncaught (in promise) TypeError: Cannot read property 'data' of null
    at bonusToParts (bonuses.js:194)
    at Object.calculateDamage (prepare.js:185)
    at damage (item.js:471)
    at prepareEffects (item.js:649)
    at Item5e.prepareData (item.js:29)
    at ClientDatabaseBackend._postUpdateDocumentCallbacks (foundry.js:8984)
    at ClientDatabaseBackend._handleUpdateDocuments (foundry.js:8914)
    at ClientDatabaseBackend._updateDocuments (foundry.js:8803)
    at async Function.updateDocuments (document.mjs:366)
    at async Item5e.update (document.mjs:448)

Analysis

The bonusToParts method assumes that the effect belongs to an actor. Adding a check that the actor is non-null in calculateDamage before calling bonusToParts seems to fix the issue. Patch is attached.

Comments (1)

  1. Log in to comment