Only return a valid RotatedBuffer in ContentClientBasic::CreateBuffer (bug 1416790, r=dvander a=gchang)
authorRyan Hunt <rhunt@eqrion.net>
Mon, 13 Nov 2017 12:52:31 -0500
changeset 704428 a706ed0c3235f882f8476c83290364d509b458aa
parent 704427 1ec9ad9a1be29b87779b9f5b895ca6d175009f5f
child 704429 645141391be71853e7a7dff8913f4df685b3ffb6
push id91167
push userbmo:csadilek@mozilla.com
push dateTue, 28 Nov 2017 16:21:38 +0000
reviewersdvander, gchang
bugs1416790
milestone58.0
Only return a valid RotatedBuffer in ContentClientBasic::CreateBuffer (bug 1416790, r=dvander a=gchang) MozReview-Commit-ID: C5l4OHAWBLL
gfx/layers/client/ContentClient.cpp
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -611,16 +611,20 @@ ContentClientBasic::CreateBuffer(gfxCont
 #endif
 
   if (!drawTarget) {
     drawTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForBackend(
       mBackend, size,
       gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType));
   }
 
+  if (!drawTarget) {
+    return nullptr;
+  }
+
   return new DrawTargetRotatedBuffer(drawTarget, nullptr, aRect, IntPoint(0,0));
 }
 
 RefPtr<CapturedPaintState>
 ContentClientBasic::BorrowDrawTargetForRecording(ContentClient::PaintState& aPaintState,
                                                  RotatedBuffer::DrawIterator* aIter,
                                                  bool aSetTransform)
 {