Added catch for stats of 0 to prevent errors.
This commit is contained in:
@@ -255,6 +255,20 @@ export class DGPercentileRoll extends DGRoll {
|
||||
return { target, localizedKey, skillPath };
|
||||
}
|
||||
|
||||
/**
|
||||
* i18n key for a user-facing warning when this roll must not be made, or null if allowed.
|
||||
* @returns {string|null}
|
||||
*/
|
||||
get blockedRollMessage() {
|
||||
if (this.type !== "stat") return null;
|
||||
|
||||
const x5 = Number(this.target);
|
||||
if (!Number.isFinite(x5) || x5 < 1) {
|
||||
return "DG.Roll.CannotRollStat";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create label based on result of roll
|
||||
*
|
||||
@@ -392,7 +406,7 @@ export class DGPercentileRoll extends DGRoll {
|
||||
|
||||
const { rollTargetModifier } = this;
|
||||
|
||||
if (!this.target || Number.isNaN(this.target)) {
|
||||
if (this.target == null || Number.isNaN(this.target)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user