[libvirt-glib 1/6] gconfig: Allow not found child in gvir_config_object_get_child_with_type

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

 



This will be useful when implementing gvir_domain_snapshot_get_parent()
as the child node 'parent' is not always present in the XML.
---
 libvirt-gconfig/libvirt-gconfig-object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 9e3b5f2..721f6cb 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -929,7 +929,8 @@ gvir_config_object_get_child_with_type(GVirConfigObject *object,
     g_return_val_if_fail(child_name != NULL, NULL);
 
     node = gvir_config_xml_get_element(object->priv->node, child_name, NULL);
-    g_return_val_if_fail(node != NULL, NULL);
+    if (node == NULL)
+        return NULL;
 
     return gvir_config_object_new_from_tree(child_type,
                                             object->priv->doc,
-- 
1.8.2.1

--
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]