diff --git a/internal/lsp/cache/cache.go b/internal/lsp/cache/cache.go index c9fa616848..be6cd91695 100644 --- a/internal/lsp/cache/cache.go +++ b/internal/lsp/cache/cache.go @@ -236,6 +236,9 @@ func (c *Cache) PackageStats(withNames bool) template.HTML { } func astCost(f *ast.File) int64 { + if f == nil { + return 0 + } var count int64 ast.Inspect(f, func(n ast.Node) bool { count += 32 // nodes are pretty small.