Skip to content

g_dbus_is_supported_address(): set error if returning FALSE

Previously, calling:

g_dbus_is_supported_address ("some-imaginary-transport:", NULL)

correctly returned FALSE; but calling:

g_dbus_is_supported_address ("some-imaginary-transport:", &error)

crashed with:

assertion failed: (ret || (!ret && (error == NULL || *error != NULL)))

This was because, if the address component did not start with a known transport, no error was set. Fix this, reusing an error string used by the corresponding else branch in g_dbus_address_connect(), and adjust the test to pass both NULL and non-NULL GError **s to this function in every test case. This case:

g_assert (!g_dbus_is_supported_address ("some-imaginary-transport:foo=bar;unix:path=/this/is/valid", NULL));

would have caught this bug with a non-NULL GError **.

Merge request reports