52b84b
From e607286e070675498fcd5a7ab73bc3da533f9eea Mon Sep 17 00:00:00 2001
52b84b
From: Balint Reczey <balint.reczey@canonical.com>
52b84b
Date: Wed, 22 Apr 2020 09:51:53 +0200
52b84b
Subject: [PATCH] shared: Don't try calling NULL callback in
52b84b
 bus_wait_for_units_clear
52b84b
52b84b
BugLink: https://bugs.launchpad.net/bugs/1870930
52b84b
(cherry picked from commit 9f656373082cb13542b877b4f5cb917ef5ff329c)
52b84b
52b84b
Related: #1830861
52b84b
---
52b84b
 src/shared/bus-wait-for-units.c | 3 ++-
52b84b
 1 file changed, 2 insertions(+), 1 deletion(-)
52b84b
52b84b
diff --git a/src/shared/bus-wait-for-units.c b/src/shared/bus-wait-for-units.c
52b84b
index de15da1620..63ba3fd422 100644
52b84b
--- a/src/shared/bus-wait-for-units.c
52b84b
+++ b/src/shared/bus-wait-for-units.c
52b84b
@@ -91,7 +91,8 @@ static void bus_wait_for_units_clear(BusWaitForUnits *d) {
52b84b
         while ((item = hashmap_first(d->items))) {
52b84b
                 d->current = item;
52b84b
 
52b84b
-                item->unit_callback(d, item->bus_path, false, item->userdata);
52b84b
+                if (item->unit_callback)
52b84b
+                        item->unit_callback(d, item->bus_path, false, item->userdata);
52b84b
                 wait_for_item_free(item);
52b84b
         }
52b84b