Correct handling of empty nodes
authorThorsten Kummermehr <thorsten.kummermehr@k2l.de>
Tue, 7 Nov 2017 15:14:34 +0000 (16:14 +0100)
committerThorsten Kummermehr <thorsten.kummermehr@k2l.de>
Tue, 7 Nov 2017 15:14:34 +0000 (16:14 +0100)
ucs2-interface/ucs-xml/UcsXml.c

index 3078749..4c392cd 100644 (file)
@@ -710,29 +710,30 @@ static ParseResult_t ParseAll(mxml_node_t *tree, UcsXmlVal_t *ucs, PrivateData_t
         if (Parse_Success != (result = ParseNode(sub, priv)))\r
             return result;\r
         /*/Iterate all connections. Node without any connection is also valid.*/\r
-        if (!GetElementArray(sub->child, ALL_CONNECTIONS, &conType, &con))\r
-            continue;\r
-        while(con)\r
+        if (GetElementArray(sub->child, ALL_CONNECTIONS, &conType, &con))\r
         {\r
-            const char *socTypeStr;\r
-            MSocketType_t socType;\r
-            mxml_node_t *soc;\r
-            memset(&priv->conData, 0, sizeof(ConnectionData_t));\r
-            if (Parse_Success != (result = ParseConnection(con, conType, priv)))\r
-                return result;\r
-            /*Iterate all sockets*/\r
-            if(!GetElementArray(con->child, ALL_SOCKETS, &socTypeStr, &soc)) RETURN_ASSERT(Parse_XmlError);\r
-            while(soc)\r
+            while(con)\r
             {\r
-                if (!GetSocketType(socTypeStr, &socType)) RETURN_ASSERT(Parse_XmlError);\r
-                if (Parse_Success != (result = ParseSocket(soc, (0 == priv->conData.sockCnt), socType, &priv->conData.jobList, priv)))\r
+                const char *socTypeStr;\r
+                MSocketType_t socType;\r
+                mxml_node_t *soc;\r
+                memset(&priv->conData, 0, sizeof(ConnectionData_t));\r
+                if (Parse_Success != (result = ParseConnection(con, conType, priv)))\r
                     return result;\r
-                ++priv->conData.sockCnt;\r
-                if(!GetElementArray(soc, ALL_SOCKETS, &socTypeStr, &soc))\r
+                /*Iterate all sockets*/\r
+                if(!GetElementArray(con->child, ALL_SOCKETS, &socTypeStr, &soc)) RETURN_ASSERT(Parse_XmlError);\r
+                while(soc)\r
+                {\r
+                    if (!GetSocketType(socTypeStr, &socType)) RETURN_ASSERT(Parse_XmlError);\r
+                    if (Parse_Success != (result = ParseSocket(soc, (0 == priv->conData.sockCnt), socType, &priv->conData.jobList, priv)))\r
+                        return result;\r
+                    ++priv->conData.sockCnt;\r
+                    if(!GetElementArray(soc, ALL_SOCKETS, &socTypeStr, &soc))\r
+                        break;\r
+                }\r
+                if(!GetElementArray(con, ALL_CONNECTIONS, &conType, &con))\r
                     break;\r
             }\r
-            if(!GetElementArray(con, ALL_CONNECTIONS, &conType, &con))\r
-                break;\r
         }\r
         ++ucs->nodSize;\r
         if (!GetElement(sub, NODE, false, &sub, false))\r