internal/lsp: handle nil pointer in (*Package).GetActionGraph
Fixes golang/go#31700
Change-Id: I1ee71f65d2bdb2a95b261c4266df64b473d2fda5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/174019
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/internal/lsp/cache/pkg.go b/internal/lsp/cache/pkg.go
index 725cc78..573be71 100644
--- a/internal/lsp/cache/pkg.go
+++ b/internal/lsp/cache/pkg.go
@@ -108,7 +108,10 @@
}
sort.Strings(importPaths) // for determinism
for _, importPath := range importPaths {
- dep := pkg.imports[importPath]
+ dep, ok := pkg.imports[importPath]
+ if !ok {
+ continue
+ }
act, err := dep.GetActionGraph(ctx, a)
if err != nil {
return nil, err
@@ -116,7 +119,6 @@
e.Deps = append(e.Deps, act)
}
}
-
e.succeeded = true
}
return e.Action, nil