diff options
author | Robin Gareus <robin@gareus.org> | 2015-01-10 19:31:50 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-01-10 19:31:50 +0100 |
commit | 38c2bdc856ce9c57264b063ee943887bc4725ba6 (patch) | |
tree | b8cd2a1bd820da4fbbc9a9ab8df42db00342ae85 | |
parent | 44203ce955f33135065456f55f1f685131174ba6 (diff) |
gracefully handle missing .midnam
Fixes bug: Add a .midnam to local preferences.
use it in a session. delete the .midnam,
reload session -> crash
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_patch_manager.h | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 33d192aa1c..6987680f26 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -440,7 +440,11 @@ MidiTimeAxisView::model_changed(const std::string& model) _midnam_custom_device_mode_selector.hide(); } - _route->instrument_info().set_external_instrument (model, device_modes.front()); + if (device_modes.size() > 0) { + _route->instrument_info().set_external_instrument (model, device_modes.front()); + } else { + _route->instrument_info().set_external_instrument (model, ""); + } // Rebuild controller menu _controller_menu_map.clear (); diff --git a/libs/ardour/ardour/midi_patch_manager.h b/libs/ardour/ardour/midi_patch_manager.h index 1b7de6a51d..5ed648b3e7 100644 --- a/libs/ardour/ardour/midi_patch_manager.h +++ b/libs/ardour/ardour/midi_patch_manager.h @@ -126,10 +126,11 @@ public: std::list<std::string> custom_device_mode_names_by_model(std::string model_name) { if (model_name != "") { - return master_device_by_model(model_name)->custom_device_mode_names(); - } else { - return std::list<std::string>(); + if (master_device_by_model(model_name)) { + return master_device_by_model(model_name)->custom_device_mode_names(); + } } + return std::list<std::string>(); } const MasterDeviceNames::Models& all_models() const { return _all_models; } |