Make sure addGotoOut always inserts its node (#8843)

Fixes #8773
This commit is contained in:
LemonBoy
2018-09-03 00:32:26 +02:00
committed by Andreas Rumpf
parent 1948eadc24
commit fd7fd1819c

View File

@@ -239,7 +239,7 @@ proc toStmtList(n: PNode): PNode =
proc addGotoOut(n: PNode, gotoOut: PNode): PNode =
# Make sure `n` is a stmtlist, and ends with `gotoOut`
result = toStmtList(n)
if result.len != 0 and result.sons[^1].kind != nkGotoState:
if result.len == 0 or result.sons[^1].kind != nkGotoState:
result.add(gotoOut)
proc newTempVar(ctx: var Ctx, typ: PType): PSym =