From a34d371252bd5a4f034560dd16b85820697e1867 Mon Sep 17 00:00:00 2001 From: LISPCoC Date: Sun, 29 Oct 2023 13:21:19 +0900 Subject: [PATCH 1/2] Prevents crash from trying to spend charge with item cleared --- src/iuse_actor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 31989ec22ff07..23a2f01b056fd 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( loc.where() == item_location::type::invalid ) { + return 0; + } return 1; } From 67d42b87cd158db8be902da09a106f6bf9d75417 Mon Sep 17 00:00:00 2001 From: LISPCoC Date: Sun, 29 Oct 2023 14:22:31 +0900 Subject: [PATCH 2/2] better handling --- src/iuse_actor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index 23a2f01b056fd..73f1291b98a96 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -5719,7 +5719,7 @@ std::optional effect_on_conditons_actor::use( Character *p, item &it, } } // Prevents crash from trying to spend charge with item removed - if( loc.where() == item_location::type::invalid ) { + if( !p->has_item( it ) ) { return 0; } return 1;