From 60964c9f2972df60c7074a37b2cc577b2e818b38 Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Tue, 17 Sep 2013 21:50:05 +0200 Subject: [PATCH] Bug fix for non-existing tags in the save file --- src/ag-app.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ag-app.c b/src/ag-app.c index c2070bc..e704394 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -130,6 +130,14 @@ get_by_xpath(xmlXPathContextPtr ctx, const gchar *xpath, XmlConvertType type) 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) { // TODO: Warn with a popup or similar way g_warning("Too many elements. This is not a valid save file!");