From: Mikko Rasa Date: Mon, 15 Mar 2021 09:13:36 +0000 (+0200) Subject: Check that the types of ternary branches exist before accessing them X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=b7f0ed12892dbf640ae944d5a76fb5aa01407ba7 Check that the types of ternary branches exist before accessing them This fixes a bug introduced in 3a1fe83 and triggered by 5e4204e. --- 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;