Bug 1096632 - Add a null check in case webgl app calls to glTexImage(<video>) while no frame inserted into ImageContainer. r=jgilbert, a=sledru
authorchiajung hung <chung@mozilla.com>
Tue, 11 Nov 2014 19:29:00 -0500
changeset 243619 6696e78c24ed
parent 243618 663d2c344792
child 243620 2dd8d79e19e4
push id4419
push userryanvm@gmail.com
push date2015-02-02 15:44 +0000
treeherdermozilla-beta@ea6cff5fd829 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, sledru
bugs1096632
milestone36.0
Bug 1096632 - Add a null check in case webgl app calls to glTexImage(<video>) while no frame inserted into ImageContainer. r=jgilbert, a=sledru
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -1782,16 +1782,19 @@ WebGLContext::TexImageFromVideoElement(c
             GenerateWarning("It is forbidden to load a WebGL texture from a cross-domain element that has not been validated with CORS. "
                                 "See https://developer.mozilla.org/en/WebGL/Cross-Domain_Textures");
             return false;
         }
     }
 
     gl->MakeCurrent();
     nsRefPtr<mozilla::layers::Image> srcImage = container->LockCurrentImage();
+    if (!srcImage)
+        return false;
+
     WebGLTexture* tex = ActiveBoundTextureForTexImageTarget(texImageTarget);
 
     const WebGLTexture::ImageInfo& info = tex->ImageInfoAt(texImageTarget, 0);
     bool dimensionsMatch = info.Width() == srcImage->GetSize().width &&
                            info.Height() == srcImage->GetSize().height;
     if (!dimensionsMatch) {
         // we need to allocation
         gl->fTexImage2D(texImageTarget.get(), level, internalFormat,