mirror of https://github.com/golang/go.git
internal/lsp: handle nil pointer in PackageStats
Fixes golang/go#40224 Change-Id: I9f3f194b1c115ff0242cbce89a36e20d9e21a41f Reviewed-on: https://go-review.googlesource.com/c/tools/+/242797 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
b42590c1b1
commit
4cea89713c
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue