summaryrefslogtreecommitdiff
path: root/src/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@unity3d.com>2010-08-25 22:42:13 +0300
committerIan Romanick <ian.d.romanick@intel.com>2010-08-25 16:22:44 -0700
commit5226f8c7b0025031e8540adc93ecfe0b36b8f90f (patch)
tree66b61e30d743b8423becee29047bc8d5bb83c3cf /src/glsl/ast_to_hir.cpp
parenta1f2ac2b37b8291d1521169b171f6c3ea683cae7 (diff)
glsl: fix crash with variable indexing into array in a struct
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r--src/glsl/ast_to_hir.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 64b142fa35..2fec02668d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1259,8 +1259,14 @@ ast_expression::hir(exec_list *instructions,
_mesa_glsl_error(&loc, state, "unsized array index must be constant");
} else {
if (array->type->is_array()) {
+ /* whole_variable_referenced can return NULL if the array is a
+ * member of a structure. In this case it is safe to not update
+ * the max_array_access field because it is never used for fields
+ * of structures.
+ */
ir_variable *v = array->whole_variable_referenced();
- v->max_array_access = array->type->array_size();
+ if (v != NULL)
+ v->max_array_access = array->type->array_size();
}
}