Fix compiler crash with empty switch statement

This commit is contained in:
drmortalwombat 2024-09-11 13:13:40 +02:00
parent f0f174e439
commit 381aaa1509

View File

@ -5302,6 +5302,8 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
sexp = sexp->mRight; sexp = sexp->mRight;
} }
if (switchNodes.Size() > 0)
{
int i = 1, j = 1; int i = 1, j = 1;
while (i < switchNodes.Size()) while (i < switchNodes.Size())
{ {
@ -5312,6 +5314,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
i++; i++;
} }
switchNodes.SetSize(j); switchNodes.SetSize(j);
}
BuildSwitchTree(proc, exp, sblock, inlineMapper, vl, switchNodes, 0, switchNodes.Size(), vleft, vright, dblock ? dblock : eblock); BuildSwitchTree(proc, exp, sblock, inlineMapper, vl, switchNodes, 0, switchNodes.Size(), vleft, vright, dblock ? dblock : eblock);