diff options
author | Juan M Gómez <info@jmgomez.me> | 2024-02-11 06:54:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-11 07:54:36 +0100 |
commit | a8c168c1688f64e8bd3acba9afee9d02bb03c649 (patch) | |
tree | 3169e021f86c77019710766469f786ea496871c1 /compiler/sempass2.nim | |
parent | ce68e11641418725a01710bd91b27c7d17c42f64 (diff) | |
download | Nim-a8c168c1688f64e8bd3acba9afee9d02bb03c649.tar.gz |
fixes a nimsuggest crash on init (#23300)
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r-- | compiler/sempass2.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 48a6b9d1c..7ddd371cd 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -106,7 +106,7 @@ proc getObjDepth(t: PType): (int, ItemId) = proc collectObjectTree(graph: ModuleGraph, n: PNode) = for section in n: - if section.kind == nkTypeDef and section[^1].kind in {nkObjectTy, nkRefTy, nkPtrTy}: + if section.kind == nkTypeDef and section[^1].kind in {nkObjectTy, nkRefTy, nkPtrTy} and section[^1].typ != nil: let typ = section[^1].typ.skipTypes(skipPtrs) if typ.kind == tyObject and typ.baseClass != nil: let (depthLevel, root) = getObjDepth(typ) |