summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2014-06-06 23:59:18 +0100
committerJosé Fonseca <[email protected]>2014-06-08 09:43:14 +0100
commiteb58aa9cf015e79a0fcf2e088676e6aa1d5dabce (patch)
treebbd74821468341492341e3f4438376b48d5a45e9 /src
parent8873120f9fb0c82cfd46cd15c39e66c38076cb0d (diff)
mesa/main: Prevent sefgault on glGetIntegerv(GL_ATOMIC_COUNTER_BUFFER_BINDING).
A recent ApiTrace change, that tries to dump more buffer state causes Mesa from my distro (10.1.4) to segfaults here. I haven't actually confirm this fixes it (I can't repro on master), but it seems a good idea to be defensive here anyway. Cc: "10.1 10.2" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/get.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 267b5f20cc3..9b56edb741b 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1005,7 +1005,11 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
/* GL_ARB_shader_atomic_counters */
case GL_ATOMIC_COUNTER_BUFFER_BINDING:
- v->value_int = ctx->AtomicBuffer->Name;
+ if (ctx->AtomicBuffer) {
+ v->value_int = ctx->AtomicBuffer->Name;
+ } else {
+ v->value_int = 0;
+ }
break;
/* GL_ARB_draw_indirect */
case GL_DRAW_INDIRECT_BUFFER_BINDING: