Bug 1230740 - wallpaper patch for a missing nullptr scenario. r=bas a=sylvestre
authorMilan Sreckovic <milan@mozilla.com>
Mon, 14 Dec 2015 13:11:00 +0100
changeset 310533 3a5e87559868af1a0afa5ed87a27d4e3b4f630cc
parent 310532 ab30cd81ac29347a6654140376f22f935baa9940
child 310534 c49a97660618e002e907ea4b65ab6d19bdf005e0
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas, sylvestre
bugs1230740
milestone45.0a2
Bug 1230740 - wallpaper patch for a missing nullptr scenario. r=bas a=sylvestre
gfx/2d/DrawTargetCairo.cpp
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -328,16 +328,20 @@ cairo_surface_t* ExtractSubImage(cairo_s
  * In either case, the caller must call cairo_surface_destroy on the
  * result when it is done with it.
  */
 cairo_surface_t*
 GetCairoSurfaceForSourceSurface(SourceSurface *aSurface,
                                 bool aExistingOnly = false,
                                 const IntRect& aSubImage = IntRect())
 {
+  if (!aSurface) {
+    return nullptr;
+  }
+
   IntRect subimage = IntRect(IntPoint(), aSurface->GetSize());
   if (!aSubImage.IsEmpty()) {
     MOZ_ASSERT(!aExistingOnly);
     MOZ_ASSERT(subimage.Contains(aSubImage));
     subimage = aSubImage;
   }
 
   if (aSurface->GetType() == SurfaceType::CAIRO) {
@@ -787,17 +791,17 @@ DrawTargetCairo::DrawSurface(SourceSurfa
                              const Rect &aSource,
                              const DrawSurfaceOptions &aSurfOptions,
                              const DrawOptions &aOptions)
 {
   if (mTransformSingular) {
     return;
   }
 
-  if (!IsValid()) {
+  if (!IsValid() || !aSurface) {
     gfxCriticalNote << "DrawSurface with bad surface " << cairo_surface_status(mSurface);
     return;
   }
 
   AutoPrepareForDrawing prep(this, mContext);
   AutoClearDeviceOffset clear(aSurface);
 
   float sx = aSource.Width() / aDest.Width();