mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 14:10:36 +01:00
core: ensure boolean properties for nm_active_connection_set_default[6]() are either TRUE or FALSE
Since @is_default is compared using ==, we should ensure that the boolean properties are always either TRUE or FALSE. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
5a4e42bc51
commit
3789e45428
1 changed files with 6 additions and 2 deletions
|
|
@ -250,6 +250,8 @@ nm_active_connection_set_default (NMActiveConnection *self, gboolean is_default)
|
|||
|
||||
g_return_if_fail (NM_IS_ACTIVE_CONNECTION (self));
|
||||
|
||||
is_default = !!is_default;
|
||||
|
||||
priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||
if (priv->is_default == is_default)
|
||||
return;
|
||||
|
|
@ -273,6 +275,8 @@ nm_active_connection_set_default6 (NMActiveConnection *self, gboolean is_default
|
|||
|
||||
g_return_if_fail (NM_IS_ACTIVE_CONNECTION (self));
|
||||
|
||||
is_default6 = !!is_default6;
|
||||
|
||||
priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||
if (priv->is_default6 == is_default6)
|
||||
return;
|
||||
|
|
@ -696,10 +700,10 @@ set_property (GObject *object, guint prop_id,
|
|||
priv->specific_object = g_value_dup_boxed (value);
|
||||
break;
|
||||
case PROP_DEFAULT:
|
||||
priv->is_default = g_value_get_boolean (value);
|
||||
priv->is_default = !!g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_DEFAULT6:
|
||||
priv->is_default6 = g_value_get_boolean (value);
|
||||
priv->is_default6 = !!g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_VPN:
|
||||
priv->vpn = g_value_get_boolean (value);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue