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-18 16:12:36 +0200
commitaf180da625664c6c2aa1f1497380223fc52ed1df (patch)
tree4f99f582f132799a39a43a0be2576a6313a9806b
parentf589c66b12a2eabd461de1bf983561cac8b56d3a (diff)
downloadNetworkManager-af180da625664c6c2aa1f1497380223fc52ed1df.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);
}