Skip to content

Commit

Permalink
Bugfix: AIM: insert items into container in corpse
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
inogenous committed Sep 12, 2023
1 parent 0dc62f9 commit 7b1e83e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/advanced_inv_pane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 7b1e83e

Please sign in to comment.