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