fixes #8893; guard against array access in renderer (#22807)

fixes #8893

(cherry picked from commit 81b2ae747e)
This commit is contained in:
ringabout
2023-10-09 21:36:56 +08:00
committed by narimiran
parent 08d37c2d7e
commit 999d29d2a0

View File

@@ -874,7 +874,7 @@ proc gproc(g: var TSrcGen, n: PNode) =
if renderNoPragmas notin g.flags:
gsub(g, n[pragmasPos])
if renderNoBody notin g.flags:
if n[bodyPos].kind != nkEmpty:
if n.len > bodyPos and n[bodyPos].kind != nkEmpty:
put(g, tkSpaces, Space)
putWithSpace(g, tkEquals, "=")
indentNL(g)