st/mesa: fix glReadBuffer(GL_NONE) segfault
authorBrian Paul <brianp@vmware.com>
Thu, 23 Jan 2014 16:47:34 +0000 (09:47 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 23 Jan 2014 18:08:40 +0000 (11:08 -0700)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73956
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
Tested-by: Ahmed Allam <ahmabdabd@hotmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_fbo.c

index 637f7ee9897b6e960b4c5ddaa07bb229621b3d23..eca04b89b5acda5de918da2247074593c9322077 100644 (file)
@@ -700,7 +700,8 @@ st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
    (void) buffer;
 
    /* add the renderbuffer on demand */
-   st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
+   if (fb->_ColorReadBufferIndex >= 0)
+      st_manager_add_color_renderbuffer(st, fb, fb->_ColorReadBufferIndex);
 }