1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Fix crash on selecting scenario with "start with strongest hero from

scenario X" starting bonus
This commit is contained in:
Ivan Savenko 2024-04-06 14:49:36 +03:00
parent 2d9e42b623
commit 1a6aae9363

View File

@ -369,7 +369,7 @@ JsonNode CampaignState::crossoverSerialize(CGHeroInstance * hero) const
CGHeroInstance * CampaignState::crossoverDeserialize(const JsonNode & node, CMap * map) const CGHeroInstance * CampaignState::crossoverDeserialize(const JsonNode & node, CMap * map) const
{ {
JsonDeserializer handler(nullptr, const_cast<JsonNode&>(node)); JsonDeserializer handler(nullptr, const_cast<JsonNode&>(node));
auto * hero = new CGHeroInstance(map->cb); auto * hero = new CGHeroInstance(map ? map->cb : nullptr);
hero->ID = Obj::HERO; hero->ID = Obj::HERO;
hero->serializeJsonOptions(handler); hero->serializeJsonOptions(handler);
if (map) if (map)