Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

Commit

Permalink
Add some error handling for setting de jure lieges, and prevent crashes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtremenak committed Mar 4, 2013
1 parent 3784c31 commit 8e1bab5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Source/CK2World/CK2Title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ void CK2Title::setDeJureLiege(const map<string, CK2Title*>& titles)
deJureLiege = titleItr->second;
deJureLiege->addDeJureVassal(this);
}
else
{
log("Error: Could not find de jure liege %s for %s.\n", deJureLiegeString.c_str(), titleString.c_str());
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion Source/CK2World/CK2World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,14 @@ void CK2World::init(Object* obj, const cultureGroupMapping& cultureGroupMap)
{
if (titleItr->first.substr(0, 1) == "b")
{
titleItr->second->setLiege(titleItr->second->getDeJureLiege());
if (titleItr->second->getDeJureLiege())
{
titleItr->second->setLiege(titleItr->second->getDeJureLiege());
}
else
{
log("Error: barony %s is independent and has no de jure liege.\n", titleItr->first.c_str());
}
}
else
{
Expand Down

0 comments on commit 8e1bab5

Please sign in to comment.