Skip to content

Commit

Permalink
Merge pull request #40098 from BevapDin/uoy
Browse files Browse the repository at this point in the history
Fix #39914 (Random error)
  • Loading branch information
ifreund authored May 3, 2020
2 parents 35fc286 + 1ed056b commit 3f4e86a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9506,9 +9506,13 @@ bool item::process( player *carrier, const tripoint &pos, bool activate, float i
return VisitResponse::NEXT;
} );
for( item *it : removed_items ) {
remove_item( *it );
// remove_item can not remove `this` itself, so don't even try.
if( it != this ) {
remove_item( *it );
}
}
return !removed_items.empty();
// Inform the caller that they need to remove `this`.
return std::find( removed_items.begin(), removed_items.end(), this ) != removed_items.end();
}

bool item::process_internal( player *carrier, const tripoint &pos, bool activate,
Expand Down

0 comments on commit 3f4e86a

Please sign in to comment.