internal/lsp: add check for nil results to fillreturns

Avoid panicking when allocating an array for a nil results list
by returning early.

Change-Id: I26953b5cef7832bad3006bd316d59978a5d94cbd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/418416
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Suzy Mueller 2022-07-19 17:38:06 -04:00
parent 79f3242e4b
commit ec1f92440b
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ outer:
break
}
}
if enclosingFunc == nil {
if enclosingFunc == nil || enclosingFunc.Results == nil {
continue
}