mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 21:10:32 +01:00
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:
parent
f589c66b12
commit
af180da625
1 changed files with 4 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue