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

Check emptiness of backlog and str_values to fix tree chopping fetch crash #36705

Merged
merged 1 commit into from Jan 5, 2020
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
5 changes: 4 additions & 1 deletion src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,10 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe
static std::vector<std::tuple<tripoint, itype_id, int>> requirements_map( player &p,
const int distance = ACTIVITY_SEARCH_DISTANCE )
{
std::vector<std::tuple<tripoint, itype_id, int>> requirement_map;
if( p.backlog.empty() || p.backlog.front().str_values.empty() ) {
return requirement_map;
}
const requirement_data things_to_fetch = requirement_id( p.backlog.front().str_values[0] ).obj();
const activity_id activity_to_restore = p.backlog.front().id();
// NOLINTNEXTLINE(performance-unnecessary-copy-initialization)
Expand All @@ -1608,7 +1612,6 @@ static std::vector<std::tuple<tripoint, itype_id, int>> requirements_map( player
p.backlog.front().id() == activity_id( "ACT_VEHICLE_REPAIR" ) ||
p.backlog.front().id() == activity_id( "ACT_MULTIPLE_FISH" );
// where it is, what it is, how much of it, and how much in total is required of that item.
std::vector<std::tuple<tripoint, itype_id, int>> requirement_map;
std::vector<std::tuple<tripoint, itype_id, int>> final_map;
std::vector<tripoint> loot_spots;
std::vector<tripoint> already_there_spots;
Expand Down