Skip to content
  • Will Thompson's avatar
    g_dbus_is_supported_address(): set error if returning FALSE · ba7b035f
    Will Thompson authored
    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:
    
        GLib-GIO:ERROR:../gio/gdbusaddress.c:434:g_dbus_is_supported_address:
        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 **.
    ba7b035f