From 00183fd26a7b51905c179a427a38bfa18d9eb2d3 Mon Sep 17 00:00:00 2001 From: sid Date: Wed, 22 May 2024 19:32:06 +0100 Subject: [PATCH] libvirt-broker: Check when broker is not valid Related: #863 --- src/libvirt-broker.vala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libvirt-broker.vala b/src/libvirt-broker.vala index 655a8c56..140e09c8 100644 --- a/src/libvirt-broker.vala +++ b/src/libvirt-broker.vala @@ -24,9 +24,10 @@ private class Boxes.LibvirtBroker : Boxes.Broker { return broker.connections.get (name); } - public async LibvirtMachine add_domain (CollectionSource source, GVir.Connection connection, GVir.Domain domain) - throws GLib.Error { - return_val_if_fail (broker != null, null); + public async LibvirtMachine? add_domain (CollectionSource source, GVir.Connection connection, GVir.Domain domain) + throws GLib.Error { + if (broker == null) + return null; if (pending_domains.find (domain) != null) { // Already being added asychronously