Bug 990082 - Add missing null check to nsWindowGfx::CreateIcon. r=sparky, a=sylvestre]
authorJonathan Watt <jwatt@jwatt.org>
Wed, 16 Apr 2014 14:40:07 +0100
changeset 192855 0fa9873c2881f2e87e7d049990e88b1740584f09
parent 192854 3ffa2cf8610c05dac1705ca70eeadb865b7126a6
child 192856 1f5e437358c48d4ab786910825ca46a21cf1c1ea
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssparky, sylvestre
bugs990082
milestone30.0a2
Bug 990082 - Add missing null check to nsWindowGfx::CreateIcon. r=sparky, a=sylvestre]
widget/windows/nsWindowGfx.cpp
--- a/widget/windows/nsWindowGfx.cpp
+++ b/widget/windows/nsWindowGfx.cpp
@@ -672,16 +672,17 @@ nsresult nsWindowGfx::CreateIcon(imgICon
                                        map.mData,
                                        dataSurface->GetSize(),
                                        map.mStride,
                                        SurfaceFormat::B8G8R8A8);
     dt->CopySurface(surface, IntRect(IntPoint(0, 0), iconSize),
                     IntPoint(0, 0));
   } else {
     dataSurface = surface->GetDataSurface();
+    NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE);
     mappedOK = dataSurface->Map(DataSourceSurface::MapType::READ, &map);
   }
   NS_ENSURE_TRUE(dataSurface && mappedOK, NS_ERROR_FAILURE);
   MOZ_ASSERT(dataSurface->GetFormat() == SurfaceFormat::B8G8R8A8);
 
   uint8_t* data = nullptr;
   nsAutoArrayPtr<uint8_t> autoDeleteArray;
   if (map.mStride == BytesPerPixel(dataSurface->GetFormat()) * iconSize.width) {