diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-04-18 14:14:17 +0100 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-04-18 14:22:51 +0100 |
commit | a372fcbe51c9ea52149187ea753f32a63d3940ac (patch) | |
tree | 60e37602dcf00bb79e44da519ed28910a4eae289 | |
parent | 5dce10500cc09dfa703f5b6e90efd5ff9ba0936e (diff) |
prevent crash when loading midi port info about ports that no longer exist
-rw-r--r-- | libs/ardour/port_manager.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index aa56ab8d43..268d7cb9fe 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -1207,19 +1207,25 @@ PortManager::fill_midi_port_info_locked () for (MidiPortInfo::iterator x = midi_port_info.begin(); x != midi_port_info.end(); ++x) { PortEngine::PortHandle ph = _backend->get_port_by_name (x->first); + if (!ph) { + /* port info saved from some condition where this port + * existed, but no longer does (i.e. device unplugged + * at present) + */ + continue; + } + if (x->second.pretty_name != x->first) { /* name set in port info ... propagate */ _backend->set_port_property (ph, "http://jackaudio.org/metadata/pretty-name", x->second.pretty_name, string()); } else { /* check with backend for pre-existing pretty name */ - if (ph) { - string value; - string type; - if (0 == _backend->get_port_property (ph, - "http://jackaudio.org/metadata/pretty-name", - value, type)) { - x->second.pretty_name = value; - } + string value; + string type; + if (0 == _backend->get_port_property (ph, + "http://jackaudio.org/metadata/pretty-name", + value, type)) { + x->second.pretty_name = value; } } } |