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;
f.open(userGroupFileName);
NLMISC::CIXml xmlStream;
xmlNodePtr globalEnclosing;
try
{
xmlStream.init(f);
// Actual loading
xmlNodePtr globalEnclosing;
globalEnclosing = xmlStream.getRootNode();
}
catch (const NLMISC::EXmlParsingError &ex)
{
nlwarning("Failed to parse '%s', skip", userGroupFileName.c_str());
return false;
}
if(!globalEnclosing)
{
nlwarning("no root element in item_group xml, skipping xml parsing");

Loading…
Cancel
Save