Nullguard against missing properties

This commit is contained in:
Dev 2024-01-08 21:17:23 +00:00
parent 878284f108
commit 5ffccddf94

View File

@ -68,7 +68,7 @@ export class RepairHelper
newCurrentDurability = itemMaxDurability; newCurrentDurability = itemMaxDurability;
} }
// Construct object to return // Update Repairable properties with new values after repair
itemToRepair.upd.Repairable = { Durability: newCurrentDurability, MaxDurability: newCurrentMaxDurability }; itemToRepair.upd.Repairable = { Durability: newCurrentDurability, MaxDurability: newCurrentMaxDurability };
// when modders set the repair coefficient to 0 it means that they dont want to lose durability on items // when modders set the repair coefficient to 0 it means that they dont want to lose durability on items
@ -100,7 +100,7 @@ export class RepairHelper
} }
// Repair mask cracks // Repair mask cracks
if (itemToRepair.upd.FaceShield && itemToRepair.upd.FaceShield.Hits > 0) if (itemToRepair.upd.FaceShield && itemToRepair.upd.FaceShield?.Hits > 0)
{ {
itemToRepair.upd.FaceShield.Hits = 0; itemToRepair.upd.FaceShield.Hits = 0;
} }