From b7f0ed12892dbf640ae944d5a76fb5aa01407ba7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 15 Mar 2021 11:13:36 +0200 Subject: [PATCH] Check that the types of ternary branches exist before accessing them This fixes a bug introduced in 3a1fe83 and triggered by 5e4204e. --- source/glsl/generate.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index 6430f9d8..70b8ad18 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -908,6 +908,9 @@ void ExpressionResolver::visit(TernaryExpression &ternary) { BasicTypeDeclaration *basic_true = dynamic_cast(ternary.true_expr->type); BasicTypeDeclaration *basic_false = dynamic_cast(ternary.false_expr->type); + if(!basic_true || !basic_false) + return; + Compatibility compat = get_compatibility(*basic_true, *basic_false); if(compat==NOT_COMPATIBLE) return; -- 2.43.0