forward-port fatal-error-saving fix for xfade loading from 2.X
[ardour.git] / libs / ardour / crossfade.cc
index d2271030a5933c4c0c5c051c9a8106c885e3ac0f..b22dd15c9cf4e31ed2d6eb972ae3a4d1c118f1d4 100644 (file)
@@ -868,6 +868,11 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
+        if (_fade_in.size() < 2) {
+                /* fade state somehow saved with no points */
+                return -1;
+        }
+
         _fade_in.front()->value = 0.0;
         _fade_in.back()->value = 1.0;
 
@@ -896,6 +901,11 @@ Crossfade::set_state (const XMLNode& node, int /*version*/)
                }
        }
 
+        if (_fade_out.size() < 2) {
+                /* fade state somehow saved with no points */
+                return -1;
+        }
+
         _fade_out.front()->value = 1.0;
         _fade_out.back()->value = 0.0;