From 92af9d69eff2a602786b23a4298a4a55bbcdd529 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Sun, 15 Sep 2019 23:30:38 -0400 Subject: [PATCH] internal/lsp: handle potential nil pointer Change-Id: I345b0d22053248f875683d87515d9e7c5e1d16c6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/195518 Reviewed-by: Ian Cottrell Run-TryBot: Rebecca Stambler --- internal/lsp/source/util.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/lsp/source/util.go b/internal/lsp/source/util.go index a0d5249df6..7feba2f36b 100644 --- a/internal/lsp/source/util.go +++ b/internal/lsp/source/util.go @@ -123,6 +123,9 @@ func pkgToMapper(ctx context.Context, view View, pkg Package, uri span.URI) (*as ph = h } } + if ph == nil { + return nil, nil, errors.Errorf("no ParseGoHandle for %s", uri) + } file, err := ph.Cached(ctx) if file == nil { return nil, nil, err