Added control to prevent invalid low/high ranges
This commit is contained in:
8
gaps.go
8
gaps.go
@@ -1,5 +1,7 @@
|
||||
package interval
|
||||
|
||||
import "fmt"
|
||||
|
||||
func (intvls *intervals) HasGaps() bool {
|
||||
intvls.Gaps()
|
||||
if intvls.GapsList != nil && len(intvls.GapsList) > 0 {
|
||||
@@ -27,7 +29,11 @@ func (intvls *intervals) calculateGaps() []*Interval {
|
||||
gapThreshold := intvls.MinLow
|
||||
for _, intvl := range intvls.Intervals {
|
||||
// convert if necessary exclusive low/high values into inclusive ones
|
||||
low, high := intvls.getInclusives(intvl.Low, intvl.High)
|
||||
low, high, err := intvls.getInclusives(intvl.Low, intvl.High)
|
||||
if err != nil {
|
||||
fmt.Printf("calculateGaps - unable to get inclusives: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
// if the current Low is higher than the last maximal High, means that there is a gap so we add this gap to the list
|
||||
if low > gapThreshold {
|
||||
|
||||
Reference in New Issue
Block a user