Merge pull request #231 from chenxiaolong/overlap

util: merge_overlapping: Skip empty and invalid ranges
This commit is contained in:
Andrew Gunnerson
2023-12-17 14:59:11 -05:00
committed by GitHub
+3 -1
View File
@@ -70,7 +70,9 @@ where
let mut result = Vec::<Range<T>>::new();
for section in sections {
if let Some(last) = result.last_mut() {
if section.start >= section.end {
continue;
} else if let Some(last) = result.last_mut() {
if section.start <= last.end {
last.end = last.end.max(section.end);
continue;