From 6cda845f1fd30a97bb56b0e899104a0fd6910944 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 20 Feb 2024 14:17:04 +0000 Subject: [PATCH] Handle when `foldItem()` tries to modify an item without a upd object --- project/src/controllers/InventoryController.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/project/src/controllers/InventoryController.ts b/project/src/controllers/InventoryController.ts index 82eef6e1..c9c148e5 100644 --- a/project/src/controllers/InventoryController.ts +++ b/project/src/controllers/InventoryController.ts @@ -340,8 +340,8 @@ export class InventoryController ): IItemEventRouterResponse { const inventoryItems = this.inventoryHelper.getOwnerInventoryItems(body, sessionID); - const sourceItem = inventoryItems.from.find(item => item._id == body.item); - const destinationItem = inventoryItems.to.find(item => item._id == body.with); + const sourceItem = inventoryItems.from.find((item) => item._id == body.item); + const destinationItem = inventoryItems.to.find((item) => item._id == body.with); if (sourceItem === null) { @@ -458,6 +458,11 @@ export class InventoryController { if (item._id && item._id === body.item) { + if (!item.upd) + { + item.upd = {}; + } + item.upd.Foldable = { Folded: body.value }; return this.eventOutputHolder.getOutput(sessionID); }