Skip to content

Commit e7f73bf

Browse files
authored
Fixes a nimsuggest crash (#24873)
1 parent c06bb6c commit e7f73bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/vmgen.nim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,10 @@ proc genCheckedObjAccess(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) =
18851885
c.freeTemp(objR)
18861886

18871887
proc genArrAccess(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags) =
1888+
if n[0].typ == nil:
1889+
globalError(c.config, n.info, "cannot access array with nil type")
1890+
return
1891+
18881892
let arrayType = n[0].typ.skipTypes(abstractVarRange-{tyTypeDesc}).kind
18891893
case arrayType
18901894
of tyString, tyCstring:

0 commit comments

Comments
 (0)