Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent segfault if repair item disappears
Prevents segfault that could previously occur if the item being repaired was invalidated. The target item being repaired could get invalidated for various reasons, such as a follower moving it via zone sorting, the item could burn up in a fire, etc. Previous segfault that this commit attempts to prevent: ``` #0 0x0000555555ef9057 in item::is_null (this=this@entry=0x0) at src/item.cpp:943 CleverRaven#1 0x000055555602322c in repair_item_actor::can_repair_target (this=this@entry=0x555560003e80, pl=..., fix=..., print_msg=print_msg@entry=true, check_consumed_available=check_consumed_available@entry=true) at src/iuse_actor.cpp:2920 CleverRaven#2 0x00005555560243c2 in repair_item_actor::repair (this=this@entry=0x555560003e80, pl=..., tool=..., fix=..., refit_only=refit_only@entry=false) at src/iuse_actor.cpp:3106 CleverRaven#3 0x00005555559d5b55 in repair_item_finish (act=0x5555580cdf58, you=0x5555580cd890, no_menu=false) at src/activity_handlers.cpp:2477 CleverRaven#4 0x0000555555a00f52 in std::function<void (player_activity*, Character*)>::operator()(player_activity*, Character*) const (this=<optimized out>, __args#0=<optimized out>, __args#0@entry=0x5555580cdf58, __args#1=<optimized out>, __args#1@entry=0x5555580cd890) at /usr/include/c++/13/bits/std_function.h:591 CleverRaven#5 0x00005555559ff229 in activity_type::call_finish (this=<optimized out>, act=act@entry=0x5555580cdf58, you=you@entry=0x5555580cd890) at src/activity_type.cpp:168 CleverRaven#6 0x00005555564e368b in player_activity::do_turn (this=0x5555580cdf58, you=...) at src/player_activity.cpp:393 CleverRaven#7 0x0000555555cec856 in do_turn () at src/do_turn.cpp:532 CleverRaven#8 0x0000555555776e74 in main (argc=<optimized out>, argv=<optimized out>) at src/main.cpp:873 ``` Instead, this commit adds a message shown to the player if the target item is no longer valid for whatever reason.
- Loading branch information