From 42e6f0aab71c56e96a141d7a3af81a87e43175a0 Mon Sep 17 00:00:00 2001 From: Harditya Ramadhan Date: Thu, 12 Oct 2017 20:04:59 +0700 Subject: [PATCH] Fixed force close bugs --- KissXML/DDXMLNode.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/KissXML/DDXMLNode.m b/KissXML/DDXMLNode.m index fa734dba..ad678dbc 100644 --- a/KissXML/DDXMLNode.m +++ b/KissXML/DDXMLNode.m @@ -1611,10 +1611,15 @@ + (void)recursiveFixDefaultNamespacesInNode:(xmlNodePtr)node withNewRoot:(xmlNod // Create a copy of the namespace, add to node's nsDef list, and then set as attribute's ns xmlNsPtr attrNsCopy = xmlNewNs(NULL, attrNs->href, attrNs->prefix); - attrNsCopy->next = node->nsDef; - node->nsDef = attrNsCopy; - - attr->ns = attrNsCopy; + if (attrNsCopy != NULL) { + attrNsCopy->next = node->nsDef; + node->nsDef = attrNsCopy; + + attr->ns = attrNsCopy; + } else { + node->nsDef = NULL; + attr->ns = NULL; + } } attrNs = attrNs->next;