From 65b0585b67d51f444d94c69f925e2ea5f351f9fe Mon Sep 17 00:00:00 2001 From: LISPCoC Date: Sun, 29 Oct 2023 22:29:41 +0900 Subject: [PATCH] Prevent crashing when using item of "effect_on_conditions" type (#68976) * Prevents crash from trying to spend charge with item cleared * better handling --- src/iuse_actor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 31989ec22ff07..73f1291b98a96 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -5718,5 +5718,9 @@ std::optional 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; }