mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-06 16:21:50 +00:00
libnm-util: handle "empty" connection-type settings correctly
nm_setting_to_hash() would return NULL if the setting had entirely default values, but this effectively meant that you could never have a connection whose "connection type" setting (eg, NMSettingWired) had all default values. (This ended up not usually being a problem in practice because most such settings had at least one property with a mandatory string value where the GObject property had a default value of NULL.) However, NMSettingGeneric will have no properties, so it would always get stripped out when converting to a hash, invalidating the connection. Fix that.
This commit is contained in:
parent
6cb786f569
commit
4d32618264
|
@ -304,8 +304,8 @@ nm_setting_to_hash (NMSetting *setting, NMSettingHashFlags flags)
|
|||
}
|
||||
g_free (property_specs);
|
||||
|
||||
/* Don't return empty hashes */
|
||||
if (g_hash_table_size (hash) < 1) {
|
||||
/* Don't return empty hashes, except for base types */
|
||||
if (g_hash_table_size (hash) < 1 && !_nm_setting_is_base_type (setting)) {
|
||||
g_hash_table_destroy (hash);
|
||||
hash = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue