]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/generate.cpp
Check that the types of ternary branches exist before accessing them
[libs/gl.git] / source / glsl / generate.cpp
index 6430f9d8a0e53d630e284f64ef4ab869a2f85925..70b8ad18efbca4ca6279435c0f908bb8d37eae15 100644 (file)
@@ -908,6 +908,9 @@ void ExpressionResolver::visit(TernaryExpression &ternary)
        {
                BasicTypeDeclaration *basic_true = dynamic_cast<BasicTypeDeclaration *>(ternary.true_expr->type);
                BasicTypeDeclaration *basic_false = dynamic_cast<BasicTypeDeclaration *>(ternary.false_expr->type);
+               if(!basic_true || !basic_false)
+                       return;
+
                Compatibility compat = get_compatibility(*basic_true, *basic_false);
                if(compat==NOT_COMPATIBLE)
                        return;