libnm-core/libnm-util: fix an assertion in adsl setting
authorJiří Klimeš <jklimes@redhat.com>
Fri, 18 Sep 2015 08:42:10 +0000 (10:42 +0200)
committerJiří Klimeš <jklimes@redhat.com>
Mon, 21 Sep 2015 13:21:50 +0000 (15:21 +0200)
(process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed

libnm-core/nm-setting-adsl.c
libnm-util/nm-setting-adsl.c

index e3c1887..900e973 100644 (file)
@@ -266,6 +266,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:
@@ -281,11 +282,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);
index c97d0a6..55d04ce 100644 (file)
@@ -286,6 +286,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:
@@ -301,11 +302,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);