Patch-Source: https://gitlab.gnome.org/GNOME/gnome-boxes/-/merge_requests/648
--
From 00183fd26a7b51905c179a427a38bfa18d9eb2d3 Mon Sep 17 00:00:00 2001
From: sid <sidtosh4@gmail.com>
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 655a8c562..140e09c86 100644
--- a/src/libvirt-broker.vala
+++ b/src/libvirt-broker.vala
@@ -24,9 +24,10 @@ public GVir.Connection get_connection (string name) {
         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
-- 
GitLab

