Skip to content

Commit 7d1d6fe

Browse files
committed
Fix possible issue adding initiative to combat
Need to take into account if the token is unassigned from an actor Fixes #1303
1 parent 63d68b1 commit 7d1d6fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fvtt/page-script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ async function addInitiativeToCombat(roll) {
414414
if (combatant) {
415415
await game.combat.updateEmbeddedDocuments("Combatant", [{ "_id": docData(combatant)._id, "initiative": roll.total }]);
416416
} else {
417-
await game.combat.createEmbeddedDocuments("Combatant", [{ "tokenId": token.id, "hidden": docData(token).hidden, "initiative": roll.total, "actorId": token.actor.id, "sceneId": token.scene.id, "img": token.actor.img }]);
417+
await game.combat.createEmbeddedDocuments("Combatant", [{ "tokenId": token.id, "hidden": docData(token).hidden, "initiative": roll.total, "actorId": token.actor?.id, "sceneId": token.scene?.id, "img": token.actor?.img }]);
418418
}
419419
} else {
420420
if (combatant) {

0 commit comments

Comments
 (0)