diff --git a/src/activity_item_handling.cpp b/src/activity_item_handling.cpp index 4d66f24b8c7bb..355ef2b82df5c 100644 --- a/src/activity_item_handling.cpp +++ b/src/activity_item_handling.cpp @@ -1592,6 +1592,10 @@ static activity_reason_info can_do_activity_there( const activity_id &act, playe static std::vector> requirements_map( player &p, const int distance = ACTIVITY_SEARCH_DISTANCE ) { + std::vector> 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) @@ -1608,7 +1612,6 @@ static std::vector> 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> requirement_map; std::vector> final_map; std::vector loot_spots; std::vector already_there_spots;