Bug 1332798 - Add null check after CreateIOSurface. r=mstange a=gchang
authorMorris Tseng <mtseng@mozilla.com>
Thu, 26 Jan 2017 17:07:07 +0800
changeset 375887 a2ed1e8da84e31071c331412f352a42e6586fca2
parent 375886 8c15bbe4488de496caa453426882214f4d703ba5
child 375888 9c0efc44eaa6738566c77af1e7244f4af2e74821
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, gchang
bugs1332798
milestone53.0a2
Bug 1332798 - Add null check after CreateIOSurface. r=mstange a=gchang MozReview-Commit-ID: 6JIR8y04cXm
widget/cocoa/RectTextureImage.mm
--- a/widget/cocoa/RectTextureImage.mm
+++ b/widget/cocoa/RectTextureImage.mm
@@ -44,16 +44,20 @@ RectTextureImage::BeginUpdate(const Layo
   if (mUpdateRegion.IsEmpty()) {
     return nullptr;
   }
 
   if (!mIOSurface || needRecreate) {
     DeleteTexture();
     mIOSurface = MacIOSurface::CreateIOSurface(mBufferSize.width,
                                                mBufferSize.height);
+
+    if (!mIOSurface) {
+      return nullptr;
+    }
   }
 
   mInUpdate = true;
 
   mIOSurface->Lock(false);
   unsigned char* ioData = (unsigned char*)mIOSurface->GetBaseAddress();
   gfx::IntSize size(mBufferSize.width, mBufferSize.height);
   int32_t stride = mIOSurface->GetBytesPerRow();