From ad1ce5f9eaa5ee78b52a878c6564b3101b047365 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Mon, 2 Jun 2025 11:20:47 +0100 Subject: [PATCH] Fix Old QBinv and new/old Psinv stashes being wiped This appeared to only happen with `jim-mechanic` repair from stash, due to the stashitem's table not being sent to the function Making it save an empty table to the database But this was possible in other places too I've added fallbacks for if it didn't receive a table, grab a fresh one from cache/database --- shared/stashcontrol.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared/stashcontrol.lua b/shared/stashcontrol.lua index aace652..b94cd1e 100644 --- a/shared/stashcontrol.lua +++ b/shared/stashcontrol.lua @@ -402,6 +402,9 @@ function stashRemoveItem(stashItems, stashName, items) debugPrint("^6Bridge^7: ^2Removing item from ^3Stash^2 with ^7"..QBInv, k, v) end else + if not stashItems or not next(stashItems) then + stashItems = getStash(stashName[1]) + end for k, v in pairs(items) do for l in pairs(stashItems) do if stashItems[l].name == k then @@ -423,6 +426,9 @@ function stashRemoveItem(stashItems, stashName, items) end elseif isStarted(PSInv) then + if not stashItems or not next(stashItems) then + stashItems = getStash(stashName[1]) + end for k, v in pairs(items) do for l in pairs(stashItems) do if stashItems[l].name == k then