Skip to content

Commit

Permalink
Prevent crashing when using item of "effect_on_conditions" type (Clev…
Browse files Browse the repository at this point in the history
…erRaven#68976)

* Prevents crash from trying to spend charge with item cleared

* better handling
  • Loading branch information
lispcoc authored and Maleclypse committed Nov 16, 2023
1 parent f431328 commit 65b0585
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/iuse_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5718,5 +5718,9 @@ std::optional<int> effect_on_conditons_actor::use( Character *p, item &it,
debugmsg( "Must use an activation eoc for activation. If you don't want the effect_on_condition to happen on its own (without the item's involvement), remove the recurrence min and max. Otherwise, create a non-recurring effect_on_condition for this item with its condition and effects, then have a recurring one queue it." );
}
}
// Prevents crash from trying to spend charge with item removed
if( !p->has_item( it ) ) {
return 0;
}
return 1;
}

0 comments on commit 65b0585

Please sign in to comment.