mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
Fix range "arithmetic"
Subtracting anything from an empty range should return an empty range, not an assert() failure Conflicts: libs/evoral/evoral/Range.hpp
This commit is contained in:
parent
a92370e07f
commit
cd61673238
1 changed files with 2 additions and 1 deletions
|
|
@ -113,6 +113,7 @@ struct /*LIBEVORAL_API*/ Range {
|
|||
Range (T f, T t) : from (f), to (t) {}
|
||||
T from; ///< start of the range
|
||||
T to; ///< end of the range
|
||||
bool empty() const { return from == to; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -191,7 +192,7 @@ RangeList<T> subtract (Range<T> range, RangeList<T> sub)
|
|||
RangeList<T> result;
|
||||
result.add (range);
|
||||
|
||||
if (sub.empty ()) {
|
||||
if (sub.empty () || range.empty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue