core/setting: don't assume we have a connection when synthesizing a property

nm_setting_to_string() operates on the setting alone, without a
connection. Tolerate that.

This fixed nm_connection_dump(vlan_connection).
This commit is contained in:
Lubomir Rintel 2018-08-09 14:55:30 +02:00
parent acbeda57fc
commit c39b134da1

View file

@ -2037,8 +2037,12 @@ _nm_setting_get_deprecated_virtual_interface_name (NMSetting *setting,
{
NMSettingConnection *s_con;
if (!connection)
return NULL;
s_con = nm_connection_get_setting_connection (connection);
g_return_val_if_fail (s_con != NULL, NULL);
if (!s_con)
return NULL;
if (nm_setting_connection_get_interface_name (s_con))
return g_variant_new_string (nm_setting_connection_get_interface_name (s_con));