Bug 958723 - Check for valid FB first. - r=gabadie

This commit is contained in:
Jeff Gilbert 2014-03-05 14:16:02 -08:00
parent a9e7191f08
commit 3b07bd07e9

View File

@ -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);