summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-08-13 13:23:12 +0200
committerThomas Haller <thaller@redhat.com>2015-09-02 09:47:29 +0200
commit493750d4952db2e20f6210859eb770d2438ffb6d (patch)
tree81e29203eee104015cae3f1601ebfdb819a18dfe
parent25fad68ad7ca5b84216c45a5e2027095be3bbaa8 (diff)
downloadNetworkManager-493750d4952db2e20f6210859eb770d2438ffb6d.tar.gz
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.
-rw-r--r--libnm-core/nm-connection.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index 5abb13abe7..1b5112cd60 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -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);
}