From c252b56c93e5d7f18e66ace296d6a46fb84b93c3 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 25 Oct 2020 04:18:56 +0800 Subject: [PATCH] Fix crash on save file corruption --- ryzom/client/src/item_group_manager.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ryzom/client/src/item_group_manager.cpp b/ryzom/client/src/item_group_manager.cpp index fddba873f..83c8b4f5a 100644 --- a/ryzom/client/src/item_group_manager.cpp +++ b/ryzom/client/src/item_group_manager.cpp @@ -301,10 +301,18 @@ bool CItemGroupManager::loadGroups() NLMISC::CIFile f; f.open(userGroupFileName); NLMISC::CIXml xmlStream; - xmlStream.init(f); - // Actual loading xmlNodePtr globalEnclosing; - globalEnclosing = xmlStream.getRootNode(); + try + { + xmlStream.init(f); + // Actual loading + 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");