Add upd null object check to addMaxResourceToKitIfMissing()
This commit is contained in:
parent
1a402dde09
commit
ce65ec1260
@ -297,6 +297,15 @@ export class RepairService
|
|||||||
protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void
|
protected addMaxResourceToKitIfMissing(repairKitDetails: ITemplateItem, repairKitInInventory: Item): void
|
||||||
{
|
{
|
||||||
const maxRepairAmount = repairKitDetails._props.MaxRepairResource;
|
const maxRepairAmount = repairKitDetails._props.MaxRepairResource;
|
||||||
|
if (!repairKitInInventory.upd)
|
||||||
|
{
|
||||||
|
this.logger.debug(`Repair kit: ${repairKitInInventory._id} in inventory lacks upd object, adding`);
|
||||||
|
repairKitInInventory.upd = {
|
||||||
|
RepairKit: {
|
||||||
|
Resource: maxRepairAmount
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
if (!repairKitInInventory.upd.RepairKit?.Resource)
|
if (!repairKitInInventory.upd.RepairKit?.Resource)
|
||||||
{
|
{
|
||||||
repairKitInInventory.upd.RepairKit = {
|
repairKitInInventory.upd.RepairKit = {
|
||||||
|
Loading…
Reference in New Issue
Block a user