summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Janes <[email protected]>2016-05-20 08:50:39 -0700
committerMark Janes <[email protected]>2016-05-20 09:52:49 -0700
commit9ca5ec2a317f00dd03d11c3463d4354baf21aaf0 (patch)
tree3f926e63a821d8454405043f6b711e089ec9873c
parent9b8c4000d0e92a1e52e2ca52f05dec5254d2a358 (diff)
glsl: Guard against NULL dereference
This trivially corrects mesa 3ca1c221, which introduced a check that crashes when a match is not found. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95005 Fixes: piglit.spec.glsl-1_50.compiler.interface-blocks-name-reused-globally-4.vert Reviewed-by: Alejandro PiƱeiro <[email protected]>
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index ecfe684a0f4..a524fbdc56f 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -6920,7 +6920,7 @@ ast_struct_specifier::hir(exec_list *instructions,
if (!state->symbols->add_type(name, t)) {
const glsl_type *match = state->symbols->get_type(name);
/* allow struct matching for desktop GL - older UE4 does this */
- if (state->is_version(130, 0) && match->record_compare(t, false))
+ if (match != NULL && state->is_version(130, 0) && match->record_compare(t, false))
_mesa_glsl_warning(& loc, state, "struct `%s' previously defined", name);
else
_mesa_glsl_error(& loc, state, "struct `%s' previously defined", name);