Bug 1208234: Stop the null pointer crash. r=bas
authorMilan Sreckovic <milan@mozilla.com>
Thu, 08 Oct 2015 15:03:36 -0700
changeset 266939 8c1e280e0bb545391c3ac9c8e29c1504a2593b06
parent 266938 571d943ef5fffb60d6e6144e63a178adaf644576
child 266940 997861ff71b1af99db75eeb9796f4f115f35871a
push id66335
push userkwierso@gmail.com
push dateThu, 08 Oct 2015 22:07:09 +0000
treeherdermozilla-inbound@997861ff71b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1208234
milestone44.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 1208234: Stop the null pointer crash. r=bas
gfx/2d/SourceSurfaceD2DTarget.cpp
--- a/gfx/2d/SourceSurfaceD2DTarget.cpp
+++ b/gfx/2d/SourceSurfaceD2DTarget.cpp
@@ -59,16 +59,21 @@ SourceSurfaceD2DTarget::GetDataSurface()
   D3D10_TEXTURE2D_DESC desc;
   mTexture->GetDesc(&desc);
 
   desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ;
   desc.Usage = D3D10_USAGE_STAGING;
   desc.BindFlags = 0;
   desc.MiscFlags = 0;
 
+  if (!Factory::GetDirect3D10Device()) {
+    gfxCriticalError() << "Invalid D3D10 device in D2D target surface";
+    return nullptr;
+  }
+
   HRESULT hr = Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(dataSurf->mTexture));
 
   if (FAILED(hr)) {
     gfxDebug() << "Failed to create staging texture for SourceSurface. Code: " << hexa(hr);
     return nullptr;
   }
   Factory::GetDirect3D10Device()->CopyResource(dataSurf->mTexture, mTexture);