Skip to content

Commit

Permalink
Prevent crash on trying to inline an empty list
Browse files Browse the repository at this point in the history
When doing stupid things, such as blacklisting all items in the game,
the game would crash on loading trying to inline an empty list of
requirements. Check that that list is not empty before attempting to
do anything with it.
  • Loading branch information
anothersimulacrum committed May 6, 2020
1 parent f530cda commit 6d54a55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/requirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ void inline_requirements( std::vector< std::vector<T> > &list, Getter getter )
iter = vec.erase( iter );

const auto &to_inline = getter( multiplied );
vec.insert( iter, to_inline.front().begin(), to_inline.front().end() );
if( !to_inline.empty() ) {
vec.insert( iter, to_inline.front().begin(), to_inline.front().end() );
}
}
}
}
Expand Down

0 comments on commit 6d54a55

Please sign in to comment.