mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Fix crash due to missing boat for neutrla heroes
This commit is contained in:
parent
f6247164ad
commit
250b27ba46
@ -110,7 +110,11 @@ void CBuilding::addNewBonus(const std::shared_ptr<Bonus> & b, BonusList & bonusL
|
||||
|
||||
CFaction::~CFaction()
|
||||
{
|
||||
delete town;
|
||||
if (town)
|
||||
{
|
||||
delete town;
|
||||
town = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t CFaction::getIndex() const
|
||||
@ -1029,7 +1033,7 @@ CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode
|
||||
faction->creatureBg120 = source["creatureBackground"]["120px"].String();
|
||||
faction->creatureBg130 = source["creatureBackground"]["130px"].String();
|
||||
|
||||
faction->boatType = EBoatId::NONE;
|
||||
faction->boatType = EBoatId::CASTLE; //Do not crash
|
||||
if (!source["boat"].isNull())
|
||||
{
|
||||
VLC->modh->identifiers.requestIdentifier("core:boat", source["boat"], [=](int32_t boatTypeID)
|
||||
|
@ -207,7 +207,7 @@ public:
|
||||
|
||||
/// Boat that will be used by town shipyard (if any)
|
||||
/// and for placing heroes directly on boat (in map editor, water prisons & taverns)
|
||||
BoatId boatType;
|
||||
BoatId boatType = BoatId(EBoatId::CASTLE);
|
||||
|
||||
|
||||
CTown * town = nullptr; //NOTE: can be null
|
||||
|
Loading…
x
Reference in New Issue
Block a user