Bug 1122367 - Null check the result of D2DFactory(). r=Bas, a=sledru
authorDavid Major <dmajor@mozilla.com>
Tue, 20 Jan 2015 10:56:59 +1300
changeset 242968 57cb206153af
parent 242967 d00b4a85897c
child 242969 f6b2623900f1
push id4350
push userryanvm@gmail.com
push date2015-01-21 19:56 +0000
treeherdermozilla-beta@4501fcac9e0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas, sledru
bugs1122367
milestone36.0
Bug 1122367 - Null check the result of D2DFactory(). r=Bas, a=sledru
gfx/2d/DrawTargetD2D1.cpp
--- a/gfx/2d/DrawTargetD2D1.cpp
+++ b/gfx/2d/DrawTargetD2D1.cpp
@@ -854,17 +854,22 @@ DrawTargetD2D1::GetByteSize() const
 
 ID2D1Factory1*
 DrawTargetD2D1::factory()
 {
   if (mFactory) {
     return mFactory;
   }
 
-  HRESULT hr = D2DFactory()->QueryInterface((ID2D1Factory1**)&mFactory);
+  ID2D1Factory* d2dFactory = D2DFactory();
+  if (!d2dFactory) {
+    return nullptr;
+  }
+
+  HRESULT hr = d2dFactory->QueryInterface((ID2D1Factory1**)&mFactory);
 
   if (FAILED(hr)) {
     return nullptr;
   }
 
   RadialGradientEffectD2D1::Register(mFactory);
 
   return mFactory;