[PATCH v3] [glib 1/5] gconfig: Allow schema to be NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]