summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-07-03 12:35:13 +0200
committerThomas Haller <thaller@redhat.com>2014-07-03 14:00:37 +0200
commitbbdae859f68b19d52f74e641426a77f39933fe5c (patch)
tree247800959c3737773a1b3468c239ab86d3af1f12
parentebeaeaed4d3180c27cc059fe0ff199153fa9ec24 (diff)
downloadNetworkManager-bbdae859f68b19d52f74e641426a77f39933fe5c.tar.gz
keyfile: avoid assertion reading keyfile without connection.type property
Avoids the following warning: (NetworkManager:26113): libnm-util-CRITICAL **: nm_connection_get_setting_by_name: assertion 'name != NULL' failed Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--src/settings/plugins/keyfile/reader.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c
index aa3cda0cdf..ff7780c845 100644
--- a/src/settings/plugins/keyfile/reader.c
+++ b/src/settings/plugins/keyfile/reader.c
@@ -1280,16 +1280,18 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
s_con = nm_connection_get_setting_connection (connection);
if (s_con) {
ctype = nm_setting_connection_get_connection_type (s_con);
- setting = nm_connection_get_setting_by_name (connection, ctype);
- if (ctype && !setting) {
- NMSetting *base_setting;
- GType base_setting_type;
-
- base_setting_type = nm_connection_lookup_setting_type (ctype);
- if (base_setting_type != G_TYPE_INVALID) {
- base_setting = (NMSetting *) g_object_new (base_setting_type, NULL);
- g_assert (base_setting);
- nm_connection_add_setting (connection, base_setting);
+ if (ctype) {
+ setting = nm_connection_get_setting_by_name (connection, ctype);
+ if (!setting) {
+ NMSetting *base_setting;
+ GType base_setting_type;
+
+ base_setting_type = nm_connection_lookup_setting_type (ctype);
+ if (base_setting_type != G_TYPE_INVALID) {
+ base_setting = (NMSetting *) g_object_new (base_setting_type, NULL);
+ g_assert (base_setting);
+ nm_connection_add_setting (connection, base_setting);
+ }
}
}