From b89d6dfd725e2d1f88cc5f1ac65bac82b33797a0 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Fri, 19 Aug 2022 19:54:39 +0300 Subject: [PATCH] Fix crash when opening bag on the bartering table --- src/inventory.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/inventory.cc b/src/inventory.cc index f7de17b..7663727 100644 --- a/src/inventory.cc +++ b/src/inventory.cc @@ -3358,8 +3358,11 @@ static void inventoryWindowOpenContextMenu(int keyCode, int inventoryWindowType) } } else { if (inventoryWindowType != INVENTORY_WINDOW_TYPE_NORMAL) { - if (objectGetOwner(item) != gDude) { - if (itemType == ITEM_TYPE_CONTAINER) { + // SFALL: Fix crash when trying to open bag/backpack on the table + // in the bartering interface. + Object* owner = objectGetOwner(item); + if (owner != gDude) { + if (itemType == ITEM_TYPE_CONTAINER && (owner == _stack[_curr_stack] || owner == _target_stack[_target_curr_stack])) { actionMenuItemsLength = 3; actionMenuItems = _act_just_use; } else {