libnm: add assertion for object returned by nm_device_get_active_connection()

I have a coredump that seems to indicate that nm_device_get_active_connection()
did not return a valid object. Let's add an assertion, trying to identify the
issue earlier. Aside from that, this change isn't useful, but an nm_assert()
shouldn't hurt anyway.
This commit is contained in:
Thomas Haller 2019-11-28 12:40:55 +01:00
parent 3604e4c112
commit 61807e9b6b
2 changed files with 9 additions and 2 deletions

View file

@ -3708,7 +3708,7 @@ _request_wait_start (GTask *task_take,
}
}
static gpointer *
static gpointer
_request_wait_finish (NMClient *client,
GAsyncResult *result,
gpointer source_tag,
@ -3732,6 +3732,8 @@ _request_wait_finish (NMClient *client,
NM_SET_OUT (out_result, g_steal_pointer (&request_data->extra_results));
r = g_steal_pointer (&request_data->result);
nm_assert (NM_IS_OBJECT (r));
_request_wait_data_free (request_data);
return r;
}

View file

@ -1418,9 +1418,14 @@ nm_device_get_state_reason (NMDevice *device)
NMActiveConnection *
nm_device_get_active_connection (NMDevice *device)
{
NMActiveConnection *ac;
g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
return nml_dbus_property_o_get_obj (&NM_DEVICE_GET_PRIVATE (device)->property_o[PROPERTY_O_IDX_ACTIVE_CONNECTION]);
ac = nml_dbus_property_o_get_obj (&NM_DEVICE_GET_PRIVATE (device)->property_o[PROPERTY_O_IDX_ACTIVE_CONNECTION]);
nm_assert (!ac || NM_IS_ACTIVE_CONNECTION (ac));
return ac;
}
/**