x/tools/internal/lsp: Bad access caused by the GetToken()
's returning nil.
#30562
Labels
Milestone
GetToken()
's returning nil.
#30562
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Running the
gopls
to receive the LSP request from the client.By the way, the essential reason why the
GetToken()
return nil is that the go source file the LSP client editing is not located in the $GOPATH. As a result, when the LSP try to load the package will fail.What did you expect to see?
Whatever the cause is, for the function who will return nil, we should provide the nil check before we access its return value.
What did you see instead?
The nil return value of
GetToken()
flows along the execute path until trigger the null pointer dereference.The text was updated successfully, but these errors were encountered: