Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent segfault if repair item disappears #75413

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2471,6 +2471,12 @@ void repair_item_finish( player_activity *act, Character *you, bool no_menu )
// Valid Repeat choice and target, attempt repair.
if( repeat != repeat_type::INIT && act->targets.size() >= 2 ) {
item_location &fix_location = act->targets[1];
if( !fix_location ) {
// The item could disappear for various reasons: moved by follower, burned up, eaten by a grue, etc.
you->add_msg_if_player( m_warning, _( "You can no longer find the item to repair." ) );
act->set_to_null();
return;
}

// Remember our level: we want to stop retrying on level up
const int old_level = you->get_skill_level( actor->used_skill );
Expand Down
Loading