From: Lennart Poettering Date: Wed, 7 Feb 2018 21:44:18 +0000 (+0100) Subject: bus: in bus_foreach_bus() don't bother with api_bus if it is NULL X-Git-Tag: v238~101^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6edd281cb88e1efc6253b418d03fdbf1d05b0af3;p=thirdparty%2Fsystemd.git bus: in bus_foreach_bus() don't bother with api_bus if it is NULL Let's better be safe than sorry, and validate that api_bus is not NULL before we send messages to it. Of course, strictly speaking this shouldn't actually be necessary, as the tracker object should not exist without the bus, but let's be extra sure. --- diff --git a/src/core/dbus.c b/src/core/dbus.c index c7c96a34098..04bed73b653 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -1204,8 +1204,9 @@ int bus_foreach_bus( } /* Send to API bus, but only if somebody is subscribed */ - if (sd_bus_track_count(m->subscribed) > 0 || - sd_bus_track_count(subscribed2) > 0) { + if (m->api_bus && + (sd_bus_track_count(m->subscribed) > 0 || + sd_bus_track_count(subscribed2) > 0)) { r = send_message(m->api_bus, userdata); if (r < 0) ret = r;