Add additional null checks to fix bustage
authorStuart Parmenter <pavlov@pavlov.net>
Wed, 08 Apr 2009 08:40:47 -0700
changeset 27159 8d5495c3449e4471ae13b4bbcf4b474112edc8b4
parent 27158 88e7b02b100ac7e195df2376b48d6dd56116fd3e
child 27160 1fc65dc2a0c203d1ec654a33e65dbe1d1d03041c
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone1.9.2a1pre
Add additional null checks to fix bustage
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -511,27 +511,30 @@ nsDisplayBackground::IsOpaque(nsDisplayL
 
   if (NS_GET_A(bg->mBackgroundColor) == 255)
     return PR_TRUE;
 
   if (bottomLayer.mRepeat == NS_STYLE_BG_REPEAT_XY) {
     if (bottomLayer.mImage.mRequest) {
       nsCOMPtr<imgIContainer> container;
       bottomLayer.mImage.mRequest->GetImage(getter_AddRefs(container));
-      
-      PRUint32 nframes;
-      container->GetNumFrames(&nframes);
-      if (nframes == 1) {
-        nsCOMPtr<gfxIImageFrame> imgFrame;
-        container->GetCurrentFrame(getter_AddRefs(imgFrame));
-        nsCOMPtr<nsIImage> img(do_GetInterface(imgFrame));
+      if (container) {
+        PRUint32 nframes;
+        container->GetNumFrames(&nframes);
+        if (nframes == 1) {
+          nsCOMPtr<gfxIImageFrame> imgFrame;
+          container->GetCurrentFrame(getter_AddRefs(imgFrame));
+          if (imgFrame) {
+            nsCOMPtr<nsIImage> img(do_GetInterface(imgFrame));
 
-        PRBool hasMask = img->GetHasAlphaMask();
+            PRBool hasMask = img->GetHasAlphaMask();
 
-        return !hasMask;
+            return !hasMask;
+          }
+        }
       }
     }
   }
 
   return PR_FALSE;
 }
 
 PRBool