Python: xml_parser: Fix error when newpkgcb returns None.
authorTomas Mlcoch <tmlcoch@redhat.com>
Mon, 10 Jun 2013 12:01:24 +0000 (14:01 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Mon, 10 Jun 2013 12:01:24 +0000 (14:01 +0200)
src/python/xml_parser-py.c

index 63fe514..faeafdd 100644 (file)
@@ -70,8 +70,14 @@ c_newpkgcb(cr_Package **pkg,
         return CR_CB_RET_ERR;
     }
 
-    *pkg = Package_FromPyObject(result);
-    data->py_pkg = result; // Store reference to current package
+    if (result == Py_None) {
+        *pkg = NULL;
+        data->py_pkg = NULL;
+        Py_DECREF(result);
+    } else {
+        *pkg = Package_FromPyObject(result);
+        data->py_pkg = result; // Store reference to current package
+    }
 
     return CR_CB_RET_OK;
 }