summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-07-27 12:10:50 -0700
committerEric Anholt <[email protected]>2010-07-27 12:10:50 -0700
commit54f583a206a15b1a92c547333adfae29ced796ef (patch)
tree227033d6e0b8f06a3f2aa0ce844349a8ff9896c6 /src
parent20c074ae28b310348a6a1920ad0ddf1e5cbb7a46 (diff)
glsl2: Don't dereference a NULL var in CE handling during a compile error.
If an undeclared variable was dereferenced in an expression that needed constant expression handling, we would walk off a null ir->var pointer. Fixes: glsl1-TIntermediate::addUnaryMath
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ir_constant_expression.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index f15530ae89e..6a07f4e1895 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -676,6 +676,10 @@ ir_swizzle::constant_expression_value()
ir_constant *
ir_dereference_variable::constant_expression_value()
{
+ /* This may occur during compile and var->type is glsl_type::error_type */
+ if (!var)
+ return NULL;
+
return var->constant_value ? var->constant_value->clone(NULL) : NULL;
}