Validation (if attempted) should just fail in this case instead of
crashing.
---
 libvirt-gconfig/libvirt-gconfig-object.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-object.c 
b/libvirt-gconfig/libvirt-gconfig-object.c
index 6225de2..851e35c 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -209,6 +209,14 @@ void gvir_config_object_validate(GVirConfigObject *config,
         return;
     }
 
+    if (!priv->schema) {
+        gvir_config_set_error_literal(err,
+                                      GVIR_CONFIG_OBJECT_ERROR,
+                                      0,
+                                      _("No XML schema associated with this 
config object"));
+        return;
+    }
+
     rngParser = xmlRelaxNGNewParserCtxt(priv->schema);
     if (!rngParser) {
         gvir_config_set_error(err,
-- 
2.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to