From 1eee0ff1202b197484305d06c776b24920505e7a Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 19 Oct 2024 20:26:05 +0100 Subject: [PATCH] Updated `addPaymentToOutput()` to ensure it validates and fixes money stacks without a upd property --- project/src/services/PaymentService.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project/src/services/PaymentService.ts b/project/src/services/PaymentService.ts index aa4222c7..f42371d7 100644 --- a/project/src/services/PaymentService.ts +++ b/project/src/services/PaymentService.ts @@ -256,6 +256,12 @@ export class PaymentService { currencyTpl, pmcData.Inventory.stash, ); + + //Ensure all money items found have a upd + for (const moneyStack of moneyItemsInInventory) { + moneyStack.upd ??= { StackObjectsCount: 1 }; + } + const amountAvailable = moneyItemsInInventory.reduce( (accumulator, item) => accumulator + item.upd.StackObjectsCount, 0,