mirror of https://github.com/golang/go.git
internal/lsp/source: handle nil pointer in rename_check.go
Fixes golang/go#42170 Change-Id: Id5b9f5767e952b63482372e5275aa162bc9ab14a Reviewed-on: https://go-review.googlesource.com/c/tools/+/264619 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:
parent
2f4fa188d9
commit
c8cfbd0f21
|
|
@ -390,7 +390,11 @@ func (r *renamer) checkStructField(from *types.Var) {
|
|||
// go/types offers no easy way to get from a field (or interface
|
||||
// method) to its declaring struct (or interface), so we must
|
||||
// ascend the AST.
|
||||
pkg, path, _ := pathEnclosingInterval(r.fset, r.packages[from.Pkg()], from.Pos(), from.Pos())
|
||||
fromPkg, ok := r.packages[from.Pkg()]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
pkg, path, _ := pathEnclosingInterval(r.fset, fromPkg, from.Pos(), from.Pos())
|
||||
if pkg == nil || path == nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue