diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-01-19 13:15:10 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-01-19 13:15:10 +0000 |
commit | c779251a3e0e9d3f6e7345251f245f1c3f057da2 (patch) | |
tree | e9a11cf0e6d061d8472b286053685b283fd303f7 /gtk2_ardour | |
parent | 051b81494c2ac4b8c6784af913b82b50e1f2eeb6 (diff) |
fix midnam-related crash introduced around 13892
git-svn-id: svn://localhost/ardour2/branches/3.0@13897 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/midi_time_axis.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index a0bd56e04a..ce073c6468 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -782,9 +782,12 @@ MidiTimeAxisView::build_controller_menu () const Glib::ustring model = _midnam_model_selector.get_active_text(); boost::shared_ptr<MIDINameDocument> midnam = MidiPatchManager::instance() .document_by_model(model); - boost::shared_ptr<MasterDeviceNames> device_names = midnam->master_device_names( - model); + boost::shared_ptr<MasterDeviceNames> device_names; + if (midnam) { + device_names = midnam->master_device_names(model); + } + if (device_names && !device_names->controls().empty()) { /* Controllers names available in midnam file, generate fancy menu */ unsigned n_items = 0; @@ -793,7 +796,7 @@ MidiTimeAxisView::build_controller_menu () l != device_names->controls().end(); ++l) { boost::shared_ptr<ControlNameList> name_list = *l; Menu* ctl_menu = NULL; - + for (ControlNameList::Controls::const_iterator c = (*l)->controls().begin(); c != (*l)->controls().end(); ++c) { const int ctl = atoi((*c)->number().c_str()); @@ -801,12 +804,12 @@ MidiTimeAxisView::build_controller_menu () /* Skip bank select controllers since they're handled specially */ continue; } - + if (n_items == 0) { /* Create a new submenu */ ctl_menu = manage (new Menu); } - + MenuList& ctl_items (ctl_menu->items()); if (chn_cnt > 1) { add_multi_channel_controller_item(ctl_items, ctl, (*c)->name()); |