summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ast_function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/glsl/ast_function.cpp')
-rw-r--r--src/compiler/glsl/ast_function.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index d1596c272e6..94e0a16a9c0 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -676,8 +676,13 @@ generate_array_index(void *mem_ctx, exec_list *instructions,
ir_variable *sub_var = NULL;
*function_name = array->primary_expression.identifier;
- match_subroutine_by_name(*function_name, actual_parameters,
- state, &sub_var);
+ if (!match_subroutine_by_name(*function_name, actual_parameters,
+ state, &sub_var)) {
+ _mesa_glsl_error(&loc, state, "Unknown subroutine `%s'",
+ *function_name);
+ *function_name = NULL; /* indicate error condition to caller */
+ return NULL;
+ }
ir_rvalue *outer_array_idx = idx->hir(instructions, state);
return new(mem_ctx) ir_dereference_array(sub_var, outer_array_idx);