Fix crash on out of range MIDI events (though this shouldn't be possible at all....
[ardour.git] / libs / ardour / curve.cc
index 380074fa19b6e07b49214e08b253462a335c7837..dcce3c0c6cd9f938c539f6d5b4f4063538e57846 100644 (file)
@@ -75,7 +75,7 @@ Curve::solve ()
 
                double lp0, lp1, fpone;
 
-               lp0 =(x[1] - x[0])/(y[1] - y[0]);
+               lp0 = (x[1] - x[0])/(y[1] - y[0]);
                lp1 = (x[2] - x[1])/(y[2] - y[1]);
 
                if (lp0*lp1 < 0) {
@@ -161,6 +161,7 @@ Curve::solve ()
 
                        /* store */
 
+                       (*xx)->create_coeffs();
                        (*xx)->coeff[0] = y[i-1] - (b * x[i-1]) - (c * xim12) - (d * xim13);
                        (*xx)->coeff[1] = b;
                        (*xx)->coeff[2] = c;
@@ -347,10 +348,9 @@ Curve::multipoint_eval (double x)
             (lookup_cache.range.first == _list.events().end()) || 
             ((*lookup_cache.range.second)->when < x))) {
                
-               AutomationList::TimeComparator cmp;
                ControlEvent cp (x, 0.0);
 
-               lookup_cache.range = equal_range (_list.events().begin(), _list.events().end(), &cp, cmp);
+               lookup_cache.range = equal_range (_list.events().begin(), _list.events().end(), &cp, AutomationList::time_comparator);
        }
 
        range = lookup_cache.range;