mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fix crash on bonus parsing failure (outdated mods?)
This commit is contained in:
parent
77dcac19a0
commit
dd17896082
@ -829,7 +829,13 @@ std::shared_ptr<Bonus> JsonUtils::parseBonus(const JsonNode &ability)
|
||||
auto b = std::make_shared<Bonus>();
|
||||
if (!parseBonus(ability, b.get()))
|
||||
{
|
||||
return nullptr;
|
||||
// caller code can not handle this case and presumes that returned bonus is always valid
|
||||
logGlobal->error("Failed to parse bonus! Json config was %S ", ability.toJson());
|
||||
|
||||
b->type = BonusType::NONE;
|
||||
assert(0); // or throw? Game *should* work with dummy bonus
|
||||
|
||||
return b;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user