libnm-core/libnm-util: fix an assertion in adsl setting

(process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed

(cherry picked from commit 3d64d45d16)
This commit is contained in:
Jiří Klimeš 2015-09-18 10:42:10 +02:00
parent 890b27adc6
commit 1f7be49519
2 changed files with 10 additions and 4 deletions

View file

@ -267,6 +267,7 @@ set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (object);
const char *str;
switch (prop_id) {
case PROP_USERNAME:
@ -282,11 +283,13 @@ set_property (GObject *object, guint prop_id,
break;
case PROP_PROTOCOL:
g_free (priv->protocol);
priv->protocol = g_ascii_strdown (g_value_get_string (value), -1);
str = g_value_get_string (value);
priv->protocol = str ? g_ascii_strdown (str, -1) : NULL;
break;
case PROP_ENCAPSULATION:
g_free (priv->encapsulation);
priv->encapsulation = g_ascii_strdown (g_value_get_string (value), -1);
str = g_value_get_string (value);
priv->encapsulation = str ? g_ascii_strdown (str, -1) : NULL;
break;
case PROP_VPI:
priv->vpi = g_value_get_uint (value);

View file

@ -287,6 +287,7 @@ set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (object);
const char *str;
switch (prop_id) {
case PROP_USERNAME:
@ -302,11 +303,13 @@ set_property (GObject *object, guint prop_id,
break;
case PROP_PROTOCOL:
g_free (priv->protocol);
priv->protocol = g_ascii_strdown (g_value_get_string (value), -1);
str = g_value_get_string (value);
priv->protocol = str ? g_ascii_strdown (str, -1) : NULL;
break;
case PROP_ENCAPSULATION:
g_free (priv->encapsulation);
priv->encapsulation = g_ascii_strdown (g_value_get_string (value), -1);
str = g_value_get_string (value);
priv->encapsulation = str ? g_ascii_strdown (str, -1) : NULL;
break;
case PROP_VPI:
priv->vpi = g_value_get_uint (value);