Bug 1384929 Check for null surfaces in DrawTarget::IntoLumaSource. r=lsalzman
authorMason Chang <mchang@mozilla.com>
Fri, 28 Jul 2017 13:49:06 -0700
changeset 420579 67bb8951ff7142d431409a6fade4064e98537508
parent 420578 980e4db21b3ed6779c36d1a21be21598565d1f16
child 420580 2fbfb1b926ef82252891b23caa051ba1e73b8f6e
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1384929
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384929 Check for null surfaces in DrawTarget::IntoLumaSource. r=lsalzman
gfx/2d/DrawTarget.cpp
--- a/gfx/2d/DrawTarget.cpp
+++ b/gfx/2d/DrawTarget.cpp
@@ -213,19 +213,27 @@ DrawTarget::StrokeGlyphs(ScaledFont* aFo
   RefPtr<Path> path = aFont->GetPathForGlyphs(aBuffer, this);
   Stroke(path, aPattern, aStrokeOptions, aOptions);
 }
 
 already_AddRefed<SourceSurface>
 DrawTarget::IntoLuminanceSource(LuminanceType aMaskType, float aOpacity)
 {
   RefPtr<SourceSurface> surface = Snapshot();
+  if (!surface) {
+    return nullptr;
+  }
+
   IntSize size = surface->GetSize();
 
   RefPtr<DataSourceSurface> maskSurface = surface->GetDataSurface();
+  if (!maskSurface) {
+    return nullptr;
+  }
+
   DataSourceSurface::MappedSurface map;
   if (!maskSurface->Map(DataSourceSurface::MapType::READ, &map)) {
     return nullptr;
   }
 
   // Create alpha channel mask for output
   RefPtr<DataSourceSurface> destMaskSurface =
     Factory::CreateDataSourceSurface(size, SurfaceFormat::A8);