diff --git a/content/canvas/src/WebGLContextGL.cpp b/content/canvas/src/WebGLContextGL.cpp index 5573ef0186d9..dd0231b63bfb 100644 --- a/content/canvas/src/WebGLContextGL.cpp +++ b/content/canvas/src/WebGLContextGL.cpp @@ -1343,6 +1343,11 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx, return JS::NullValue(); } + if (!mBoundFramebuffer) { + ErrorInvalidOperation("getFramebufferAttachmentParameter: cannot query framebuffer 0"); + return JS::NullValue(); + } + if (attachment != LOCAL_GL_DEPTH_ATTACHMENT && attachment != LOCAL_GL_STENCIL_ATTACHMENT && attachment != LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) @@ -1365,11 +1370,6 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx, } } - if (!mBoundFramebuffer) { - ErrorInvalidOperation("getFramebufferAttachmentParameter: cannot query framebuffer 0"); - return JS::NullValue(); - } - MakeContextCurrent(); const WebGLFramebuffer::Attachment& fba = mBoundFramebuffer->GetAttachment(attachment);