[gtk+/nth-child: 26/33] stylecontext: Don't crash when colors are "none"



commit fdd0e7d64339c47f6ce4dafe34b0c49d119db74d
Author: Benjamin Otte <otte redhat com>
Date:   Fri May 27 23:58:10 2011 +0200

    stylecontext: Don't crash when colors are "none"
    
    Instead, use their default value (pink).

 gtk/gtkstylecontext.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index b93dc36..d0ab18b 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -3369,7 +3369,10 @@ gtk_style_context_get_color (GtkStyleContext *context,
   if (value)
     {
       c = g_value_get_boxed (value);
-      *color = *c;
+      if (c)
+        *color = *c;
+      else
+        gdk_rgba_parse (color, "pink");
     }
 }
 
@@ -3410,7 +3413,10 @@ gtk_style_context_get_background_color (GtkStyleContext *context,
   if (value)
     {
       c = g_value_get_boxed (value);
-      *color = *c;
+      if (c)
+        *color = *c;
+      else
+        gdk_rgba_parse (color, "pink");
     }
 }
 
@@ -3451,7 +3457,10 @@ gtk_style_context_get_border_color (GtkStyleContext *context,
   if (value)
     {
       c = g_value_get_boxed (value);
-      *color = *c;
+      if (c)
+        *color = *c;
+      else
+        gdk_rgba_parse (color, "pink");
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]