gracefully handle missing .midnam

Fixes bug: Add a .midnam to local preferences.
use it in a session. delete the .midnam,
reload session -> crash
This commit is contained in:
Robin Gareus 2015-01-10 19:31:50 +01:00
parent 44203ce955
commit 38c2bdc856
2 changed files with 9 additions and 4 deletions

View file

@ -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 ();

View file

@ -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; }