Bug 1260178 - Null check pattern from -unico-border-gradient. r=acomminos, a=ritu
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 29 Mar 2016 17:50:47 +1300
changeset 351484 84d924134d1384e94d3227f21915f28b2841a9d7
parent 351483 470551cf10ebceb65c7b36c4fb6d6f51c2974562
child 351485 477b227b6224431e51ac256e37e96498e4843cf4
push id15502
push userahunt@mozilla.com
push dateThu, 14 Apr 2016 20:27:48 +0000
reviewersacomminos, ritu
bugs1260178
milestone47.0a2
Bug 1260178 - Null check pattern from -unico-border-gradient. r=acomminos, a=ritu MozReview-Commit-ID: HooAlTmINmq
widget/gtk/nsLookAndFeel.cpp
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -78,16 +78,18 @@ GetLightAndDarkness(const GdkRGBA& aColo
 static bool
 GetGradientColors(const GValue* aValue,
                   GdkRGBA* aLightColor, GdkRGBA* aDarkColor)
 {
     if (!G_TYPE_CHECK_VALUE_TYPE(aValue, CAIRO_GOBJECT_TYPE_PATTERN))
         return false;
 
     auto pattern = static_cast<cairo_pattern_t*>(g_value_get_boxed(aValue));
+    if (!pattern)
+        return false;
 
     // Just picking the lightest and darkest colors as simple samples rather
     // than trying to blend, which could get messy if there are many stops.
     if (CAIRO_STATUS_SUCCESS !=
         cairo_pattern_get_color_stop_rgba(pattern, 0, nullptr, &aDarkColor->red,
                                           &aDarkColor->green, &aDarkColor->blue,
                                           &aDarkColor->alpha))
         return false;