Skip to content

Commit

Permalink
Fix ubercrash when CPR isn't detected
Browse files Browse the repository at this point in the history
  • Loading branch information
Eligarf committed Aug 18, 2024
1 parent 84b0589 commit f6491de
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/systems/dnd5e.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ class Engine5e extends Engine {

getSettingsParameters(version) {
let settings = super.getSettingsParameters(version);
let cpr = chrisPremades?.utils?.effectUtils?.getSidebarEffectData;
let cpr = undefined;
if (typeof chrisPremades !== typeof undefined) {
cpr = chrisPremades?.utils?.effectUtils?.getSidebarEffectData;
}
if (cpr) {
settings.hiddenSource.choices.cpr = "stealthy.source.cpr.name";
settings.spotSource.choices.cpr = "stealthy.source.cpr.name";
Expand Down Expand Up @@ -286,7 +289,10 @@ class Engine5e extends Engine {
if (source !== 'cpr')
return super.createSourcedEffect({ name, actor, source, makeEffect });
const beforeV11 = Math.floor(game.version) < 11;
let effect = chrisPremades?.utils?.effectUtils?.getSidebarEffectData(name);
let effect = undefined;
if (typeof chrisPremades !== typeof undefined) {
effect = chrisPremades?.utils?.effectUtils?.getSidebarEffectData(name);
}
if (effect) {
await actor.createEmbeddedDocuments('ActiveEffect', [effect]);
effect = actor.effects.find((e) => name === (beforeV11 ? e.label : e.name));
Expand Down

0 comments on commit f6491de

Please sign in to comment.