Bug fix for non-existing tags in the save file

This commit is contained in:
Gergely Polonkai 2013-09-17 21:50:05 +02:00
parent ff6285ef94
commit 60964c9f29

View File

@ -130,6 +130,14 @@ get_by_xpath(xmlXPathContextPtr ctx, const gchar *xpath, XmlConvertType type)
return NULL; return NULL;
} }
if (xpathObj->nodesetval == NULL) {
// TODO: Warn with a popup or similar way
g_warning("Required element not found. This is not a valid save file!");
xmlXPathFreeObject(xpathObj);
return NULL;
}
if (xpathObj->nodesetval->nodeNr > 1) { if (xpathObj->nodesetval->nodeNr > 1) {
// TODO: Warn with a popup or similar way // TODO: Warn with a popup or similar way
g_warning("Too many elements. This is not a valid save file!"); g_warning("Too many elements. This is not a valid save file!");