Skip to content

Commit

Permalink
Fixed a bug where sorting would sometimes cause an error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cidan committed Sep 2, 2024
1 parent 358504b commit b8de9df
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions data/stacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ function stack:AddToStack(item)
-- Always ensure the lead item in the stack is the one with the most count.
for slotkey in pairs(stackinfo.slotkeys) do
local childData = items:GetItemDataFromSlotKey(slotkey)
if childData.itemInfo.currentItemCount > rootItemData.itemInfo.currentItemCount or
(childData.itemInfo.currentItemCount == rootItemData.itemInfo.currentItemCount and childData.slotkey > stackinfo.rootItem) then
if rootItemData.isItemEmpty or
(not childData.isItemEmpty and ((childData.itemInfo.currentItemCount > rootItemData.itemInfo.currentItemCount) or
(childData.itemInfo.currentItemCount == rootItemData.itemInfo.currentItemCount and childData.slotkey > stackinfo.rootItem))) then
stackinfo.slotkeys[stackinfo.rootItem] = true
stackinfo.slotkeys[slotkey] = nil
stackinfo.rootItem = slotkey
Expand Down

0 comments on commit b8de9df

Please sign in to comment.