projects
/
ardour.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9ca0ce4
)
Fix range "arithmetic"
author
Paul Davis
<paul@linuxaudiosystems.com>
Wed, 31 Dec 2014 12:43:43 +0000
(07:43 -0500)
committer
Paul Davis
<paul@linuxaudiosystems.com>
Wed, 31 Dec 2014 12:43:43 +0000
(07:43 -0500)
Subtracting anything from an empty range should return an empty range, not an assert() failure
libs/evoral/evoral/Range.hpp
patch
|
blob
|
history
diff --git
a/libs/evoral/evoral/Range.hpp
b/libs/evoral/evoral/Range.hpp
index 476970f663a860e232014a60b9aaa145adafbe84..230b28974722f4c45b3c0786ce87e84a6b0f9fc1 100644
(file)
--- a/
libs/evoral/evoral/Range.hpp
+++ b/
libs/evoral/evoral/Range.hpp
@@
-137,6
+137,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 (inclusive: to lies inside the range)
+ bool empty() const { return from == to; }
};
template<typename T>
@@
-215,7
+216,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;
}