mirror of
https://github.com/golang/go
synced 2024-11-18 13:34:41 -07:00
internal/lsp/source: fix nil pointer in extract function
Ran into this while debugging another issue. Change-Id: I154493418c7676a24457a4e11431ad4f0311c07a Reviewed-on: https://go-review.googlesource.com/c/tools/+/246757 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Baum <joshbaum@google.com>
This commit is contained in:
parent
e5d681aac7
commit
d55f2eddcb
@ -477,8 +477,8 @@ func adjustRangeForWhitespace(rng span.Range, tok *token.File, content []byte) s
|
||||
rng.Start = tok.Pos(offset)
|
||||
|
||||
offset = tok.Offset(rng.End)
|
||||
for offset-1 >= 0 {
|
||||
if !unicode.IsSpace(rune(content[offset-1])) {
|
||||
for o := offset - 1; 0 <= o && o < len(content); {
|
||||
if !unicode.IsSpace(rune(content[o])) {
|
||||
break
|
||||
}
|
||||
// Move backwards one byte to find a non-whitespace character.
|
||||
|
Loading…
Reference in New Issue
Block a user