internal/lsp/source: handle a possible nil pointer in call hierarchy

Change-Id: I90e7b09853485cfd99a99eadd534e47fe69fb1ca
Reviewed-on: https://go-review.googlesource.com/c/tools/+/260800
Trust: Rebecca Stambler <rstambler@golang.org>
Trust: Danish Dua <danishdua@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Danish Dua <danishdua@google.com>
This commit is contained in:
Rebecca Stambler 2020-10-08 20:50:07 -04:00
parent 96877f285f
commit fcf82128ed
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,10 @@ func PrepareCallHierarchy(ctx context.Context, snapshot Snapshot, fh FileHandle,
}
return nil, err
}
// The identifier can be nil if it is an import spec.
if identifier == nil {
return nil, nil
}
if _, ok := identifier.Declaration.obj.Type().Underlying().(*types.Signature); !ok {
return nil, nil