internal/lsp: handle nil pointer exceptions in check for Go files
internal/lsp: handle nil pointer exceptions in check for Go files

Fixes golang/go#42240

Change-Id: I48382613c9eb9d021a9e1dc9ca6ab6b4b1dfcf8f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/265763
Trust: Rebecca Stambler <d7cf11e5f299d88ea8348366a9fc4f7c335c3afa@golang.org>
Run-TryBot: Rebecca Stambler <d7cf11e5f299d88ea8348366a9fc4f7c335c3afa@golang.org>
gopls-CI: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
Reviewed-by: Robert Findley <9179eee875d1ee628c37fb47d7e749e855ffd21f@google.com>
TryBot-Result: Go Bot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>

golang/tools,golang/tools,golang/tools,golang/tools,golang/tools