summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-10-09 21:36:56 +0800
committerGitHub <noreply@github.com>2023-10-09 15:36:56 +0200
commit81b2ae747e307f4ab171d3b62a0e6ea8b6a81d3d (patch)
tree7da4f317bc4f1ecf9fbeef5524ccb688dd3a3df8
parent8ac466980f7658c37b05c6ec099537ea0e459cb9 (diff)
downloadNim-81b2ae747e307f4ab171d3b62a0e6ea8b6a81d3d.tar.gz
fixes #8893; guard against array access in renderer (#22807)
fixes #8893
-rw-r--r--compiler/renderer.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim
index 41078716b..3a6d0ae65 100644
--- a/compiler/renderer.nim
+++ b/compiler/renderer.nim
@@ -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)