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,16 +1280,18 @@ 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);
|
||||||
setting = nm_connection_get_setting_by_name (connection, ctype);
|
if (ctype) {
|
||||||
if (ctype && !setting) {
|
setting = nm_connection_get_setting_by_name (connection, ctype);
|
||||||
NMSetting *base_setting;
|
if (!setting) {
|
||||||
GType base_setting_type;
|
NMSetting *base_setting;
|
||||||
|
GType base_setting_type;
|
||||||
|
|
||||||
base_setting_type = nm_connection_lookup_setting_type (ctype);
|
base_setting_type = nm_connection_lookup_setting_type (ctype);
|
||||||
if (base_setting_type != G_TYPE_INVALID) {
|
if (base_setting_type != G_TYPE_INVALID) {
|
||||||
base_setting = (NMSetting *) g_object_new (base_setting_type, NULL);
|
base_setting = (NMSetting *) g_object_new (base_setting_type, NULL);
|
||||||
g_assert (base_setting);
|
g_assert (base_setting);
|
||||||
nm_connection_add_setting (connection, base_setting);
|
nm_connection_add_setting (connection, base_setting);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user