From 7b1e83e654652756ebe1e50d7b1f5a1e8a142a26 Mon Sep 17 00:00:00 2001 From: inogenous <123803852+inogenous@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:14:06 +0200 Subject: [PATCH] Bugfix: AIM: insert items into container in corpse * Prevents segfault in AIM when inserting items into a toplevel container that is carried by a corpse. * How to reproduce issue being resolved: 1. Stand adjacent to corpse 2. Corpse is wearing "garter belt" 3. Enter AIM, have "all" on left and "inventory" on right 4. Navigate to "garter belt" on left and press `c` to open it as container 5. Switch to right AIM pane and navigate to an item in your inventory, for example "matchbook" 6. Press enter to move "matchbook" into "garter belt" 7. Segfault --- src/advanced_inv_pane.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/advanced_inv_pane.cpp b/src/advanced_inv_pane.cpp index 8957e701ec202..aa606ccca7d63 100644 --- a/src/advanced_inv_pane.cpp +++ b/src/advanced_inv_pane.cpp @@ -260,8 +260,8 @@ void advanced_inventory_pane::add_items_from_area( advanced_inv_area &square, if( it->is_corpse() ) { for( item *loot : it->all_items_top( item_pocket::pocket_type::CONTAINER ) ) { if( !is_filtered( *loot ) ) { - advanced_inv_listitem aim_item( item_location( loc_cursor, loot ), 0, 1, square.id, - is_in_vehicle ); + advanced_inv_listitem aim_item( item_location( item_location( loc_cursor, it ), loot ), + 0, 1, square.id, is_in_vehicle ); square.volume += aim_item.volume; square.weight += aim_item.weight; items.push_back( aim_item );