Prevent randomiseItemUpdProperties() running if the item being randomised has a db item with no _props data

This commit is contained in:
Dev 2023-08-04 08:49:22 +01:00
parent e3b5ed44bf
commit 281cba8db5

View File

@ -546,6 +546,13 @@ export class FenceService
*/ */
protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void protected randomiseItemUpdProperties(itemDetails: ITemplateItem, itemToAdjust: Item): void
{ {
if (!itemDetails._props)
{
this.logger.error(`Item ${itemDetails._name} lacks a _props field, unable to randomise item: ${itemToAdjust._id}`);
return;
}
// Randomise hp resource of med items // Randomise hp resource of med items
if ("MaxHpResource" in itemDetails._props && itemDetails._props.MaxHpResource > 0) if ("MaxHpResource" in itemDetails._props && itemDetails._props.MaxHpResource > 0)
{ {