Skip to content

Commit

Permalink
Merge pull request #75310 from inogenous/segfault-using-bandage-from-…
Browse files Browse the repository at this point in the history
…spillable-container

Prevent segfault when target of firstaid_activity_actor disappears
  • Loading branch information
akrieger authored Jul 30, 2024
2 parents 8062226 + 6172c11 commit 0b942b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6648,6 +6648,11 @@ void firstaid_activity_actor::finish( player_activity &act, Character &who )
static const std::string iuse_name_string( "heal" );

item_location it = act.targets.front();
if( !it ) {
debugmsg( "Lost tool used for healing" );
act.set_to_null();
return;
}
item *used_tool = it->get_usable_item( iuse_name_string );
if( used_tool == nullptr ) {
debugmsg( "Lost tool used for healing" );
Expand Down

0 comments on commit 0b942b3

Please sign in to comment.