diff options
author | Kenneth Graunke <[email protected]> | 2012-03-13 14:59:42 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2012-03-26 10:21:55 -0700 |
commit | dca19a771156685895892740f687cee7cf84a8c9 (patch) | |
tree | 37d0213ac4cd61b7ac49dfd35011517a7308e877 /src/glsl/ast_to_hir.cpp | |
parent | 2cd652f810e3417ff458f23a8c72a0c84e342258 (diff) |
glsl: Explicitly NULL-check variables before making a dereference.
The constructor currently returns a ir_dereference_variable of error
type when provided NULL, but that's about to change in the next commit.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 75d7e9d5793..ff56e33b7aa 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -1692,14 +1692,14 @@ ast_expression::hir(exec_list *instructions, ir_variable *var = state->symbols->get_variable(this->primary_expression.identifier); - result = new(ctx) ir_dereference_variable(var); - if (var != NULL) { var->used = true; + result = new(ctx) ir_dereference_variable(var); } else { _mesa_glsl_error(& loc, state, "`%s' undeclared", this->primary_expression.identifier); + result = ir_call::get_error_instruction(ctx); error_emitted = true; } break; |