mirror of
https://github.com/vsariola/sointu.git
synced 2025-05-25 18:00:37 -04:00
fix(tracker): MakeSetLength did not handle invalid parameters
(cherry picked from commit 1b824f77ab40dbabba4586de4b97bb113e8ee264)
This commit is contained in:
parent
b255a68ebc
commit
8d71cf3ca7
@ -783,6 +783,9 @@ func MakeMoveRanges(a Range, delta int) [4]Range {
|
||||
// duplicate elements so all elements are equally spaced, and tries to remove
|
||||
// elements from the middle of the range.
|
||||
func MakeSetLength(a Range, length int) []Range {
|
||||
if length <= 0 || a.Len() <= 0 {
|
||||
return []Range{{a.Start, a.Start}}
|
||||
}
|
||||
ret := make([]Range, a.Len(), max(a.Len(), length)+2)
|
||||
for i := 0; i < a.Len(); i++ {
|
||||
ret[i] = Range{a.Start + i, a.Start + i + 1}
|
||||
|
Loading…
Reference in New Issue
Block a user