libnm: don't assert in nm_connection_get_*() for verified connection

Those getters are convenience methods to retrieve the id/type from
the NMSettingConnection. If the NMSettingConnection was missing
(and thus the connection invalid) we would raise an assertion.

Don't be so strict and just silently return NULL.
Otherwise, the caller cannot use the functions on unverified
connections.
This commit is contained in:
Thomas Haller 2015-08-13 13:23:12 +02:00
parent f589c66b12
commit af180da625

View file

@ -1518,7 +1518,8 @@ nm_connection_get_id (NMConnection *connection)
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = nm_connection_get_setting_connection (connection);
g_return_val_if_fail (s_con != NULL, NULL);
if (!s_con)
return NULL;
return nm_setting_connection_get_id (s_con);
}
@ -1539,7 +1540,8 @@ nm_connection_get_connection_type (NMConnection *connection)
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
s_con = nm_connection_get_setting_connection (connection);
g_return_val_if_fail (s_con != NULL, NULL);
if (!s_con)
return NULL;
return nm_setting_connection_get_connection_type (s_con);
}