diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index af3c595..9bff9d4 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -878,6 +878,9 @@ _mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format) GLenum _mesa_get_color_read_format(struct gl_context *ctx) { + if (ctx->ReadBuffer == NULL || ctx->ReadBuffer->_ColorReadBuffer == NULL) + return 0; + const GLenum data_type = _mesa_get_format_datatype( ctx->ReadBuffer->_ColorReadBuffer->Format); @@ -902,6 +905,9 @@ _mesa_get_color_read_format(struct gl_context *ctx) GLenum _mesa_get_color_read_type(struct gl_context *ctx) { + if (ctx->ReadBuffer == NULL || ctx->ReadBuffer->_ColorReadBuffer == NULL) + return 0; + const GLenum data_type = _mesa_get_format_datatype( ctx->ReadBuffer->_ColorReadBuffer->Format);