Fix crash on verbose note text in regions with no patch changes.
authorDavid Robillard <d@drobilla.net>
Sun, 20 Jan 2013 04:52:42 +0000 (04:52 +0000)
committerDavid Robillard <d@drobilla.net>
Sun, 20 Jan 2013 04:52:42 +0000 (04:52 +0000)
... I think.  Not sure precisely, conditions were fuzzy, I just tortured my
mouse button until I could reproduce it.

git-svn-id: svn://localhost/ardour2/branches/3.0@13921 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/midi_region_view.cc

index ec0a426ccb8d49dadac1a65568873b8eafbd8479..acd63469c6fc18953a16ef96a6631eda4df19277 100644 (file)
@@ -1865,7 +1865,7 @@ MidiRegionView::get_patch_key_at (double time, uint8_t channel, MIDI::Name::Patc
                --i;
        }
 
-       if (patch_applies(*i, time, channel)) {
+       if (i != _model->patch_changes().end() && patch_applies(*i, time, channel)) {
                key.bank_number    = (*i)->bank();
                key.program_number = (*i)->program ();
        } else {