fix possible 'manditory child missing' when loading mp campaign games

the error could happen a soon as you advance to the next scenario if you reload a campaign save from another player.
This commit is contained in:
gfgtdf 2018-05-31 21:35:17 +02:00 committed by Charles Dang
parent 03d0e5deee
commit 575e104ca5

View file

@ -119,7 +119,9 @@ config initial_level_config(saved_game& state)
const std::vector<std::string>& mods = params.active_mods;
for(unsigned i = 0; i < mods.size(); ++i) {
level.add_child("modification", game_config.find_child("modification", "id", mods[i]));
if(const config& mod_cfg = game_config.find_child("modification", "id", mods[i])) {
level.add_child("modification", mod_cfg);
}
}
// This will force connecting clients to be using the same version number as us.