internal/lsp/source: handle nil pointer exception in completion

Fixes golang/vscode-go#923

Change-Id: I168228876e0bfc4de12b88697494898287f8762b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/270098
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Rebecca Stambler 2020-11-14 12:39:37 -05:00
parent 1643af1435
commit 61ea331ec0
1 changed files with 6 additions and 2 deletions

View File

@ -121,12 +121,16 @@ outer:
cand := c.deepState.dequeue()
obj := cand.obj
if obj == nil {
continue
}
// At the top level, dedupe by object.
if len(cand.path) == 0 {
if c.seen[cand.obj] {
if c.seen[obj] {
continue
}
c.seen[cand.obj] = true
c.seen[obj] = true
}
// If obj is not accessible because it lives in another package and is