diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-29 06:34:02 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-30 01:51:39 +0800 |
commit | ffcadeeaa38d0cdeda9558d2d32d523ac2c69b51 (patch) | |
tree | 82128d4134e5d78897e98861065e7019b48955b5 /libgnomecanvas | |
parent | 71811d735e20c2fdaa0d525b0a01b993155c50ef (diff) | |
download | gsoc2013-evolution-ffcadeeaa38d0cdeda9558d2d32d523ac2c69b51.tar.gz gsoc2013-evolution-ffcadeeaa38d0cdeda9558d2d32d523ac2c69b51.tar.zst gsoc2013-evolution-ffcadeeaa38d0cdeda9558d2d32d523ac2c69b51.zip |
GnomeCanvasShape: Make color string parsing more robust
Diffstat (limited to 'libgnomecanvas')
-rw-r--r-- | libgnomecanvas/gnome-canvas-shape.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c index d506fc8919..0ef588c97c 100644 --- a/libgnomecanvas/gnome-canvas-shape.c +++ b/libgnomecanvas/gnome-canvas-shape.c @@ -245,6 +245,7 @@ gnome_canvas_shape_set_property (GObject *object, GnomeCanvasShapePriv *priv; GdkColor color; GdkColor *colorptr; + const gchar *color_string; item = GNOME_CANVAS_ITEM (object); shape = GNOME_CANVAS_SHAPE (object); @@ -252,8 +253,14 @@ gnome_canvas_shape_set_property (GObject *object, switch (param_id) { case PROP_FILL_COLOR: - if (g_value_get_string (value) && - gdk_color_parse (g_value_get_string (value), &color)) { + color_string = g_value_get_string (value); + if (color_string != NULL) { + if (gdk_color_parse (color_string, &color)) { + g_warning ( + "Failed to parse color '%s'", + color_string); + break; + } priv->fill_set = TRUE; priv->fill_rgba = get_rgba_from_color (&color); } else if (priv->fill_set) @@ -285,8 +292,14 @@ gnome_canvas_shape_set_property (GObject *object, break; case PROP_OUTLINE_COLOR: - if (g_value_get_string (value) && - gdk_color_parse (g_value_get_string (value), &color)) { + color_string = g_value_get_string (value); + if (color_string != NULL) { + if (!gdk_color_parse (color_string, &color)) { + g_warning ( + "Failed to parse color '%s'", + color_string); + break; + } priv->outline_set = TRUE; priv->outline_rgba = get_rgba_from_color (&color); } else if (priv->outline_set) |