Fix crash on iteration over an empty sequence and/or recording controllers only.
[ardour.git] / libs / evoral / src / ControlList.cpp
index 90ef106ce56257418cff1b71ce0fb362295f68a8..22517e68a06c81e500cf7b9cdb1881a2851e8bcb 100644 (file)
@@ -993,7 +993,8 @@ ControlList::rt_safe_earliest_event_discrete_unlocked (double start, double end,
 bool
 ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, double& x, double& y, bool inclusive) const
 {
-       cerr << "earliest_event(start: " << start << ", end: " << end << ", x: " << x << ", y: " << y << ", inclusive: " << inclusive <<  ")" << endl;
+       //cerr << "earliest_event(start: " << start << ", end: " << end
+       //<< ", x: " << x << ", y: " << y << ", inclusive: " << inclusive <<  ")" << endl;
 
        const_iterator length_check_iter = _events.begin();
        if (_events.empty()) // 0 events
@@ -1285,8 +1286,10 @@ ControlList::paste (ControlList& alist, double pos, float times)
 
 /** Move automation around according to a list of region movements */
 void
-ControlList::move_ranges (RangeMoveList const & movements)
+ControlList::move_ranges (const list< RangeMove<double> >& movements)
 {
+       typedef list< RangeMove<double> > RangeMoveList;
+
        {
                Glib::Mutex::Lock lm (_lock);
 
@@ -1304,8 +1307,8 @@ ControlList::move_ranges (RangeMoveList const & movements)
                /* copy the events into the new list */
                for (RangeMoveList::const_iterator i = movements.begin (); i != movements.end (); ++i) {
                        iterator j = old_events.begin ();
-                       EventTime const limit = i->from + i->length;
-                       EventTime const dx = i->to - i->from;
+                       const double limit = i->from + i->length;
+                       const double dx    = i->to - i->from;
                        while (j != old_events.end () && (*j)->when <= limit) {
                                if ((*j)->when >= i->from) {
                                        ControlEvent* ev = new ControlEvent (**j);