From bccfc9bf4a800d8d37b61b7c5a3a8b2c03c6c8f3 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Tue, 18 Feb 2014 09:32:49 +1300 Subject: [PATCH] Bug 966543 - null check mSurface in MacIOSurfaceTextureHostOGL. r=nical --- gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp index e823eba45a9..64697bc00c0 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp @@ -46,7 +46,7 @@ MacIOSurfaceTextureHostOGL::MacIOSurfaceTextureHostOGL(TextureFlags aFlags, bool MacIOSurfaceTextureHostOGL::Lock() { - if (!mCompositor) { + if (!mCompositor || !mSurface) { return false; } @@ -95,11 +95,17 @@ MacIOSurfaceTextureSourceOGL::gl() const gfx::SurfaceFormat MacIOSurfaceTextureHostOGL::GetFormat() const { + if (!mSurface) { + return gfx::SurfaceFormat::UNKNOWN; + } return mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8X8; } gfx::IntSize MacIOSurfaceTextureHostOGL::GetSize() const { + if (!mSurface) { + return gfx::IntSize(); + } return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight()); }