From f97eea45a17d867065d43518bd94037ae88aba9a Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Sat, 27 Apr 2019 00:00:15 -0400 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Cottrell --- internal/lsp/cache/pkg.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/lsp/cache/pkg.go b/internal/lsp/cache/pkg.go index 725cc78d..573be719 100644 --- a/internal/lsp/cache/pkg.go +++ b/internal/lsp/cache/pkg.go @@ -108,7 +108,10 @@ func (pkg *Package) GetActionGraph(ctx context.Context, a *analysis.Analyzer) (* } 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 @@ func (pkg *Package) GetActionGraph(ctx context.Context, a *analysis.Analyzer) (* e.Deps = append(e.Deps, act) } } - e.succeeded = true } return e.Action, nil