Skip to content

Commit c7d803c

Browse files
adonovangopherbot
authored andcommitted
gopls/internal/golang: add missing ,ok check
Fixes golang/go#74058 Change-Id: Ia128f224fc4ca7326320e43b1e485f846d50b846 Reviewed-on: https://go-review.googlesource.com/c/tools/+/680257 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
1 parent 7c45fee commit c7d803c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gopls/internal/golang/hover.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ func hover(ctx context.Context, snapshot *cache.Snapshot, fh file.Handle, pp pro
356356
}
357357
if obj, ok := obj.(*types.Var); ok && obj.IsField() {
358358
if selExpr, ok := cur.Parent().Node().(*ast.SelectorExpr); ok {
359-
sel := pkg.TypesInfo().Selections[selExpr]
360-
if len(sel.Index()) > 1 {
359+
sel, ok := pkg.TypesInfo().Selections[selExpr]
360+
if ok && len(sel.Index()) > 1 {
361361
var buf bytes.Buffer
362362
buf.WriteString(" // through ")
363363
t := typesinternal.Unpointer(sel.Recv())

0 commit comments

Comments
 (0)