Commits

ph...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed 0546eac

Modified Files:
LibXML.xs
o dunno if this fixes Philip Molter's problem. if so, we need to fix
other functions as well.

  • Participants
  • Parent commits bb608cd

Comments (0)

Files changed (1)

         setSvNodeExtra(docfrag_sv, docfrag_sv);
 
         elname = nodeSv2C( name , (xmlNodePtr) real_dom );
-
-        newNode = xmlNewNode(NULL , elname);
-        xmlFree(elname);
-        
-        newNode->doc = real_dom;
-        domAppendChild( docfrag, newNode );
-        # warn( newNode->name );
-        RETVAL = nodeToSv(newNode);
-        setSvNodeExtra(RETVAL,docfrag_sv);
+        if ( elname != NULL || xmlStrlen(elname) > 0 ) {
+            newNode = xmlNewNode(NULL , elname);
+            xmlFree(elname);
+
+            if ( newNode != NULL ) {        
+                newNode->doc = real_dom;
+                domAppendChild( docfrag, newNode );
+                # warn( newNode->name );
+                RETVAL = nodeToSv(newNode);
+                setSvNodeExtra(RETVAL,docfrag_sv);
+            }
+            else {
+                XSRETURN_UNDEF;
+            }
+        }
+        else {
+            XSRETURN_UNDEF;
+        }
     OUTPUT:
         RETVAL