From 1f1d9dc1b5ffaf605c0e506952497a8809ddab88 Mon Sep 17 00:00:00 2001 From: XLightningStormL Date: Wed, 14 May 2025 09:48:52 +1000 Subject: [PATCH] Fixed a major bug Fixed a potential loop crash caused by an undefined amount int in TakeInventory (and derivatives) now it will assume if by is less than 1 that the item is to be destroyed. --- wadsrc/static/zscript/actors/inventory/inventory.zs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/actors/inventory/inventory.zs b/wadsrc/static/zscript/actors/inventory/inventory.zs index 10ee3a5f2..986bf786d 100644 --- a/wadsrc/static/zscript/actors/inventory/inventory.zs +++ b/wadsrc/static/zscript/actors/inventory/inventory.zs @@ -932,7 +932,7 @@ class Inventory : Actor //=========================================================================== virtual void DepleteBy(int by) { - if (amount < 1 || by >= amount) + if (by < 1 || amount < 1 || by >= amount) { DepleteOrDestroy(); }