Bug 1208234 - Stop the null pointer crash. r=bas, a=sylvestre
authorMilan Sreckovic <milan@mozilla.com>
Thu, 08 Oct 2015 15:03:36 -0700
changeset 296364 2c0e8f1cdb03c18e7efeac47a0658c3608697576
parent 296363 c939b2f3a39b39ef272dc3594c8b87a977c34611
child 296365 725efd9e78e05c59afcd40a857074d15af4754a4
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas, sylvestre
bugs1208234
milestone43.0a2
Bug 1208234 - Stop the null pointer crash. r=bas, a=sylvestre
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);