internal/lsp: handle potential nil pointer

Change-Id: I345b0d22053248f875683d87515d9e7c5e1d16c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195518
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Rebecca Stambler 2019-09-15 23:30:38 -04:00
parent 1ccc110ba9
commit 92af9d69ef
1 changed files with 3 additions and 0 deletions

View File

@ -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