libubus: Check if remove callback exists before call it
[oweals/ubus.git] / libubus-obj.c
index ed18ca99f4ecff13bd0f16e82c859d870d580e66..bdb2e03478d70541691448ff7e2b672e0711871e 100644 (file)
@@ -27,7 +27,8 @@ ubus_process_unsubscribe(struct ubus_context *ctx, struct ubus_msghdr *hdr,
                return;
 
        s = container_of(obj, struct ubus_subscriber, obj);
-       s->remove_cb(ctx, s, blob_get_u32(attrbuf[UBUS_ATTR_TARGET]));
+       if (s->remove_cb)
+               s->remove_cb(ctx, s, blob_get_u32(attrbuf[UBUS_ATTR_TARGET]));
 }
 
 static void