From 9cf5386bb12e4cd89d5f698e464023b52bbb9523 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 17 Oct 2008 08:04:03 +0000 Subject: [PATCH] 2008-10-17 Emmanuele Bassi * clutter/clutter-color.c (clutter_color_parse): Add checks for the arguments, to avoid trying to parse NULL strings. --- ChangeLog | 5 +++++ clutter/clutter-color.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fba3eea..8bc7f34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-10-17 Emmanuele Bassi + + * clutter/clutter-color.c (clutter_color_parse): Add checks + for the arguments, to avoid trying to parse NULL strings. + 2008-10-16 Emmanuele Bassi * clutter/clutter-container.[ch]: Add checks to the Container diff --git a/clutter/clutter-color.c b/clutter/clutter-color.c index 8888a09..1cca736 100644 --- a/clutter/clutter-color.c +++ b/clutter/clutter-color.c @@ -482,6 +482,9 @@ clutter_color_parse (const gchar *color, { PangoColor pango_color; + g_return_val_if_fail (color != NULL, FALSE); + g_return_val_if_fail (dest != NULL, FALSE); + /* parse ourselves to get alpha */ if (color[0] == '#') { @@ -491,9 +494,9 @@ clutter_color_parse (const gchar *color, { if (strlen (color) == 9) { - dest->red = result >> 24 & 0xff; + dest->red = (result >> 24) & 0xff; dest->green = (result >> 16) & 0xff; - dest->blue = (result >> 8) & 0xff; + dest->blue = (result >> 8) & 0xff; dest->alpha = result & 0xff; return TRUE; @@ -501,7 +504,7 @@ clutter_color_parse (const gchar *color, else if (strlen (color) == 7) { dest->red = (result >> 16) & 0xff; - dest->green = (result >> 8) & 0xff; + dest->green = (result >> 8) & 0xff; dest->blue = result & 0xff; dest->alpha = 0xff; -- 2.7.4