Skip to content

Commit f890f0f

Browse files
committed
Fix invalid item Documents preventing all physical item updates
1 parent 64b66a7 commit f890f0f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/module/item/physical/helpers.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,13 @@ function handleHPChange(item: PhysicalItemPF2e, changed: DeepPartial<PhysicalIte
270270
const itemIndex = actorSource?.items.findIndex((i) => i._id === item._id);
271271
if (itemIndex === -1) return;
272272
actorSource?.items.splice(itemIndex ?? 0, 1, changedSource);
273-
const actorClone = actorSource ? new ActorProxyPF2e(actorSource) : null;
273+
const actorClone = ((): ActorPF2e | null => {
274+
// Catch invalid items in the actor clone preventing other items from updating
275+
try {
276+
return actorSource ? new ActorProxyPF2e(actorSource) : null;
277+
} catch {}
278+
return null;
279+
})();
274280
const itemClone = actorClone?.inventory.get(item.id, { strict: true }) ?? item.clone(changed, { keepId: true });
275281

276282
// Adjust current HP proportionally if max HP changed

0 commit comments

Comments
 (0)