Skip to content

Commit

Permalink
gracefully handle missing .midnam
Browse files Browse the repository at this point in the history
Fixes bug: Add a .midnam to local preferences.
use it in a session. delete the .midnam,
reload session -> crash
  • Loading branch information
x42 committed Jan 10, 2015
1 parent 44203ce commit 38c2bdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion gtk2_ardour/midi_time_axis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down
7 changes: 4 additions & 3 deletions libs/ardour/ardour/midi_patch_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ class LIBARDOUR_API MidiPatchManager : public PBD::ScopedConnectionList, 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; }
Expand Down

0 comments on commit 38c2bdc

Please sign in to comment.