Re: [patch] obexd: if path == NULL, don't call dbus_connection_get_object_path_data

Marcel Holtmann
2008-12-24T03:41:36Z

Hi Raymond,

> Just a minor fix for g_dbus_unregister_interface to avoid calling dbus_connection_get_object_path_data when path is NULL.

@@ -494,7 +494,7 @@ gboolean g_dbus_unregister_interface(DBusConnection *connection,
struct generic_data *data = NULL;
struct interface_data *iface;

- if (dbus_connection_get_object_path_data(connection, path,
+ if (!path || dbus_connection_get_object_path_data(connection, path,
(void *) &data) == FALSE)
return FALSE;

So doing some like this would be better:

if (!path)
return FALSE;

if (dbus_connection ...)
return FALSE;

You should really start thinking for the error => return paradigm all
the time. This makes the code a lot simpler to read.

Regards

Marcel