Ensure the maximum of either ranges is preserved

This commit is contained in:
modmuss50 2022-11-16 22:28:53 +00:00
parent f24e8f0631
commit c6f6b6f49c

View file

@ -48,7 +48,7 @@ public final class RangeUtil {
var last = out.getLast(); var last = out.getLast();
if (last.getMaximum() >= range.getMinimum() -1) { if (last.getMaximum() >= range.getMinimum() -1) {
out.removeLast(); out.removeLast();
out.add(Range.between(last.getMinimum(), range.getMaximum())); out.add(Range.between(last.getMinimum(), Math.max(last.getMaximum(), range.getMaximum())));
} else { } else {
out.add(range); out.add(range);
} }