Protect from error when no actor (e.g. enricher) (#1273)

Co-authored-by: Chris Ryan <chrisr@blackhole>
This commit is contained in:
Chris Ryan 2025-11-12 17:29:33 +10:00 committed by GitHub
parent 72bf0171b3
commit 977715d22a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,9 +29,11 @@ export default class DHRoll extends Roll {
config.hooks = [...this.getHooks(), ''];
config.dialog ??= {};
const actorIdSplit = config.source.actor.split('.');
const tagTeamSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll);
config.tagTeamSelected = tagTeamSettings.members[actorIdSplit[actorIdSplit.length - 1]];
const actorIdSplit = config.source?.actor?.split('.');
if (actorIdSplit) {
const tagTeamSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.TagTeamRoll);
config.tagTeamSelected = tagTeamSettings.members[actorIdSplit[actorIdSplit.length - 1]];
}
for (const hook of config.hooks) {
if (Hooks.call(`${CONFIG.DH.id}.preRoll${hook.capitalize()}`, config, message) === false) return null;