mirror of
https://github.com/golang/go
synced 2024-11-18 10:04:43 -07:00
internal/span: return error when on spans with invalid starts
Fixes golang/go#30155 Change-Id: I7f9dbec6fdfa92654f58627ef44ee4bfe2870fa6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/169440 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
c02eab13f0
commit
cd3f3f06fc
@ -65,6 +65,9 @@ func (r Range) Span() (Span, error) {
|
||||
return Span{}, fmt.Errorf("file not found in FileSet")
|
||||
}
|
||||
s := Span{v: span{URI: FileURI(f.Name())}}
|
||||
if !r.Start.IsValid() {
|
||||
return Span{}, fmt.Errorf("invalid position for start of range")
|
||||
}
|
||||
s.v.Start.Offset = f.Offset(r.Start)
|
||||
if r.End.IsValid() {
|
||||
s.v.End.Offset = f.Offset(r.End)
|
||||
|
Loading…
Reference in New Issue
Block a user