From 49c2a69a45ea2348fa8f93bec2510f13dd4a582c Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 19 Dec 2020 08:26:00 -0800 Subject: [PATCH] Fixed incorrectly allowed type mismatch on payload enum case --- IDEHelper/Compiler/BfStmtEvaluator.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/IDEHelper/Compiler/BfStmtEvaluator.cpp b/IDEHelper/Compiler/BfStmtEvaluator.cpp index 29960fe8..bfc0be0d 100644 --- a/IDEHelper/Compiler/BfStmtEvaluator.cpp +++ b/IDEHelper/Compiler/BfStmtEvaluator.cpp @@ -4464,9 +4464,12 @@ void BfModule::Visit(BfSwitchStatement* switchStmt) } } - constantInt = mBfIRBuilder->GetConstant(caseValue.mValue); - if ((constantInt != NULL) && (!mBfIRBuilder->IsInt(constantInt->mTypeCode))) - constantInt = NULL; + if (caseValue.mType == switchValue.mType) + { + constantInt = mBfIRBuilder->GetConstant(caseValue.mValue); + if ((constantInt != NULL) && (!mBfIRBuilder->IsInt(constantInt->mTypeCode))) + constantInt = NULL; + } } }