Null check metadata (#1145)

* Null check metadata

* Fix d20RollDialog action find

---------

Co-authored-by: Chris Ryan <chrisr@blackhole>
Co-authored-by: Dapoolp <elcatnet@gmail.com>
This commit is contained in:
Chris Ryan 2025-09-19 06:28:25 +10:00 committed by GitHub
parent 55586c93c8
commit f1b5c80a53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -16,7 +16,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
this.action =
config.data.attack?._id == config.source.action
? config.data.attack
: this.item.system.actions.get(config.source.action);
: this.item.system.actionsList?.find(a => a.id === config.source.action);
}
}

View file

@ -103,7 +103,7 @@ export default class CostField extends fields.ArrayField {
static calcCosts(costs) {
const resources = CostField.getResources.call(this, costs);
let filteredCosts = costs;
if (this.parent.metadata.isQuantifiable && this.parent.consumeOnUse === false) {
if (this.parent?.metadata.isQuantifiable && this.parent.consumeOnUse === false) {
filteredCosts = filteredCosts.filter(c => c.key !== 'quantity');
}