From a8c168c1688f64e8bd3acba9afee9d02bb03c649 Mon Sep 17 00:00:00 2001 From: Juan M Gómez Date: Sun, 11 Feb 2024 06:54:36 +0000 Subject: fixes a nimsuggest crash on init (#23300) --- compiler/sempass2.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/sempass2.nim') 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) -- cgit 1.4.1-2-gfad0