Report an error when trying to parse the current XML document
associated with the GVirConfig object when no document has been
set.
---
 libvirt-gconfig/libvirt-gconfig-object.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-object.c 
b/libvirt-gconfig/libvirt-gconfig-object.c
index 4a58323..6f80346 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -187,6 +187,14 @@ gvir_config_object_parse(GVirConfigObject *config,
     if (priv->docHandle)
         return;
 
+    if (!priv->doc) {
+        *err = g_error_new(GVIR_CONFIG_OBJECT_ERROR,
+                           0,
+                           "%s",
+                           "No XML document to parse");
+        return;
+    }
+
     priv->docHandle = xmlParseMemory(priv->doc, strlen(priv->doc));
     if (!priv->docHandle) {
         *err = gvir_xml_error_new(GVIR_CONFIG_OBJECT_ERROR,
-- 
1.7.6.4

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to