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>
This commit is contained in:
Thomas Haller
2014-07-03 12:35:13 +02:00
parent ebeaeaed4d
commit bbdae859f6

View File

@@ -1280,8 +1280,9 @@ 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);
if (ctype) {
setting = nm_connection_get_setting_by_name (connection, ctype);
if (ctype && !setting) {
if (!setting) {
NMSetting *base_setting;
GType base_setting_type;
@@ -1292,6 +1293,7 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
nm_connection_add_setting (connection, base_setting);
}
}
}
/* Make sure that we have 'id' even if not explictly specified in the keyfile */
if (!nm_setting_connection_get_id (s_con)) {