summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-20 06:57:52 +0000
committerDavid Robillard <d@drobilla.net>2013-01-20 06:57:52 +0000
commit022e590429acfb3e3361734035aa1543527e9bc4 (patch)
tree2662e88a19428db93fec339eaea2d90350786736 /gtk2_ardour
parentbade953de3d1196028fc58ffaca98b01517650b1 (diff)
Fix crash when trimming MIDI region with automation.
This seems impossible, but it happens. Reproduction instructions: 1) Click in an empty portion of MIDI track to create a region 2) Add a CC lane 3) Click some points into lane (perhaps unnecessary) 4) Switch lane to linear mode (perhaps unnecessary) 5) Attempt to extend region leftward (with draw tool, but probaby doesn't matter) 6) Boom Note trimming still doesn't work in this case and something seems deeply broken, but at least it doesn't crash now. git-svn-id: svn://localhost/ardour2/branches/3.0@13922 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_drag.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 95b75db2ec..5d8a4cc672 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -1851,12 +1851,17 @@ TrimDrag::finished (GdkEvent* event, bool movement_occurred)
}
}
}
-
- if (_operation == StartTrim) {
- _editor->maybe_locate_with_edit_preroll ( _views.begin()->view->region()->position() );
- }
- if (_operation == EndTrim) {
- _editor->maybe_locate_with_edit_preroll ( _views.begin()->view->region()->position() + _views.begin()->view->region()->length() );
+
+ if (!_views.empty()) {
+ if (_operation == StartTrim) {
+ _editor->maybe_locate_with_edit_preroll(
+ _views.begin()->view->region()->position());
+ }
+ if (_operation == EndTrim) {
+ _editor->maybe_locate_with_edit_preroll(
+ _views.begin()->view->region()->position() +
+ _views.begin()->view->region()->length());
+ }
}
if (!_editor->selection->selected (_primary)) {