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

fixes #8893
This commit is contained in:
ringabout
2023-10-09 21:36:56 +08:00
committed by GitHub
parent 8ac466980f
commit 81b2ae747e

View File

@@ -864,7 +864,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)