mirror of https://github.com/golang/go.git
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:
parent
96877f285f
commit
fcf82128ed
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue