summaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_algebraic.cpp
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2015-07-04 22:40:59 +0100
committerNeil Roberts <neil@linux.intel.com>2015-07-06 11:52:37 -0700
commit86a3557d7c95ac945eedf42ab095639b255c1bed (patch)
tree6b1922f35a8b9c243701c38689bc27f4fc82bdbb /src/glsl/opt_algebraic.cpp
parent18039078e0254c7cb5e15b7186be05e2e4c10f38 (diff)
downloadexternal_mesa3d-86a3557d7c95ac945eedf42ab095639b255c1bed.zip
external_mesa3d-86a3557d7c95ac945eedf42ab095639b255c1bed.tar.gz
external_mesa3d-86a3557d7c95ac945eedf42ab095639b255c1bed.tar.bz2
glsl: Make sure not to dereference NULL
In this bit of code point_five can be NULL if the expression is not a constant. This fixes it to match the pattern of the rest of the chunk of code so that it checks for NULLs. Cc: Matt Turner <mattst88@gmail.com> Cc: "10.6" <mesa-stable@lists.freedesktop.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
-rw-r--r--src/glsl/opt_algebraic.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 9b8a426..c4b8715 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -589,7 +589,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
continue;
ir_constant *point_five = add_expr->operands[1 - j]->as_constant();
- if (!point_five->is_value(0.5, 0))
+ if (!point_five || !point_five->is_value(0.5, 0))
continue;
if (abs_expr->operands[0]->equals(sign_expr->operands[0])) {