Improve handling of XML errors for fix permissions
diff --git a/fixPermissions.cpp b/fixPermissions.cpp
index 1d2c518..5d4b0d2 100644
--- a/fixPermissions.cpp
+++ b/fixPermissions.cpp
@@ -443,15 +443,19 @@
 	xmlFile.read(&xmlBuf[0], len);
 	xmlBuf[len] = '\0';
 	xml_document<> pkgDoc;
+	LOGINFO("parsing package, %i...\n", len);
 	pkgDoc.parse<parse_full>(&xmlBuf[0]);
 
 	xml_node<> * pkgNode = pkgDoc.first_node("packages");
-	xml_node <> * next = pkgNode->first_node("package");
-
-	if (next == NULL) {
+	if (pkgNode == NULL) {
 		LOGERR("No packages found to fix.\n");
 		return -1;
 	}
+	xml_node <> * next = pkgNode->first_node("package");
+	if (next == NULL) {
+		LOGERR("No package found to fix.\n");
+		return -1;
+	}
 
 	//Get packages
 	while (next->first_attribute("name") != NULL) {
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 4c7bf5b..8755689 100644
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -90,7 +90,8 @@
 {
   fprintf (stderr, "Parser error: %s\n", what);
   fprintf (stderr, "  Start of string: %s\n", (char *) where);
-  abort ();
+  LOGERR("Error parsing XML file.\n");
+  //abort ();
 }
 
 static void
diff --git a/gui/rapidxml.hpp b/gui/rapidxml.hpp
index d98173e..c0a7be4 100644
--- a/gui/rapidxml.hpp
+++ b/gui/rapidxml.hpp
@@ -1745,8 +1745,10 @@
                 // Skip until end of declaration

                 while (text[0] != Ch('?') || text[1] != Ch('>'))

                 {

-                    if (!text[0])

+                    if (!text[0]) {

                         RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+						return 0;

+					}

                     ++text;

                 }

                 text += 2;    // Skip '?>'

@@ -1780,8 +1782,10 @@
                 // Skip until end of comment

                 while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>'))

                 {

-                    if (!text[0])

+                    if (!text[0]) {

                         RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+						return 0;

+					}

                     ++text;

                 }

                 text += 3;     // Skip '-->'

@@ -1794,8 +1798,10 @@
             // Skip until end of comment

             while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>'))

             {

-                if (!text[0])

+                if (!text[0]) {

                     RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+					return 0;

+				}

                 ++text;

             }

 

@@ -1837,7 +1843,7 @@
                         {

                             case Ch('['): ++depth; break;

                             case Ch(']'): --depth; break;

-                            case 0: RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+                            case 0: RAPIDXML_PARSE_ERROR("unexpected end of data", text); return 0;

                         }

                         ++text;

                     }

@@ -1847,6 +1853,7 @@
                 // Error on end of text

                 case Ch('\0'):

                     RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+					return 0;

                 

                 // Other character, skip it

                 default:

@@ -1903,8 +1910,10 @@
                 // Skip to '?>'

                 while (text[0] != Ch('?') || text[1] != Ch('>'))

                 {

-                    if (*text == Ch('\0'))

+                    if (*text == Ch('\0')) {

                         RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+						return 0;

+					}

                     ++text;

                 }

 

@@ -1926,8 +1935,10 @@
                 // Skip to '?>'

                 while (text[0] != Ch('?') || text[1] != Ch('>'))

                 {

-                    if (*text == Ch('\0'))

+                    if (*text == Ch('\0')) {

                         RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+						return 0;

+					}

                     ++text;

                 }

                 text += 2;    // Skip '?>'

@@ -2005,8 +2016,10 @@
                 // Skip until end of cdata

                 while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>'))

                 {

-                    if (!text[0])

+                    if (!text[0]) {

                         RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+						return 0;

+					}

                     ++text;

                 }

                 text += 3;      // Skip ]]>

@@ -2017,8 +2030,10 @@
             Ch *value = text;

             while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>'))

             {

-                if (!text[0])

+                if (!text[0]) {

                     RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+					return 0;

+				}

                 ++text;

             }

 

@@ -2154,8 +2169,10 @@
                 ++text;     // Skip !

                 while (*text != Ch('>'))

                 {

-                    if (*text == 0)

+                    if (*text == 0) {

                         RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+						return 0;

+					}

                     ++text;

                 }

                 ++text;     // Skip '>'

@@ -2224,6 +2241,7 @@
                 // End of data - error

                 case Ch('\0'):

                     RAPIDXML_PARSE_ERROR("unexpected end of data", text);

+					return;

 

                 // Data node

                 default: