Fix crash on save file corruption

develop
kaetemi 4 years ago
parent 2568b6f321
commit c252b56c93

@ -301,10 +301,18 @@ bool CItemGroupManager::loadGroups()
NLMISC::CIFile f; NLMISC::CIFile f;
f.open(userGroupFileName); f.open(userGroupFileName);
NLMISC::CIXml xmlStream; NLMISC::CIXml xmlStream;
xmlNodePtr globalEnclosing;
try
{
xmlStream.init(f); xmlStream.init(f);
// Actual loading // Actual loading
xmlNodePtr globalEnclosing;
globalEnclosing = xmlStream.getRootNode(); globalEnclosing = xmlStream.getRootNode();
}
catch (const NLMISC::EXmlParsingError &ex)
{
nlwarning("Failed to parse '%s', skip", userGroupFileName.c_str());
return false;
}
if(!globalEnclosing) if(!globalEnclosing)
{ {
nlwarning("no root element in item_group xml, skipping xml parsing"); nlwarning("no root element in item_group xml, skipping xml parsing");

Loading…
Cancel
Save