amb: do not use NULL values when handling errors.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Fri, 19 Sep 2014 12:34:48 +0000 (15:34 +0300)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 8 Jan 2015 16:37:17 +0000 (18:37 +0200)
Change-Id: I81462ccd97b8462768cd8a964d693817ec1cb507

src/plugins/plugin-amb.c

index dd5c43c..9888c34 100644 (file)
@@ -299,11 +299,15 @@ static void destroy_prop(data_t *ctx, dbus_property_watch_t *w)
     mrp_htbl_foreach(o->dbus_properties, count_keys_cb, &len);
 
     if (len == 0) {
-        mrp_dbus_unsubscribe_signal(ctx->dbus, property_signal_handler, o,
-                NULL, o->path,
-                "org.freedesktop.DBus.Properties",
-                "PropertiesChanged", NULL);
-        mrp_htbl_remove(ctx->dbus_property_objects, o->path, TRUE);
+        if (ctx->dbus) {
+            mrp_dbus_unsubscribe_signal(ctx->dbus, property_signal_handler, o,
+                    NULL, o->path,
+                    "org.freedesktop.DBus.Properties",
+                    "PropertiesChanged", NULL);
+        }
+        if (ctx->dbus_property_objects) {
+           mrp_htbl_remove(ctx->dbus_property_objects, o->path, TRUE);
+        }
     }
 
     mrp_free(w->key);