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>
This commit is contained in:
Rebecca Stambler 2019-04-27 00:00:15 -04:00
parent 7af746645d
commit f97eea45a1
1 changed files with 4 additions and 2 deletions

View File

@ -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