diff options
author | David Robillard <d@drobilla.net> | 2010-12-16 22:35:31 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-16 22:35:31 +0000 |
commit | 7634d93e798c410a079127524f34b50a8b2a825a (patch) | |
tree | 58852de3be87f6815e8e9161e375802e08c269de /src/PatchageCanvas.cpp | |
parent | c283ec04fa3bf728d34d9ef2a8dd74576b4e821b (diff) | |
download | patchage-7634d93e798c410a079127524f34b50a8b2a825a.tar.gz patchage-7634d93e798c410a079127524f34b50a8b2a825a.tar.bz2 patchage-7634d93e798c410a079127524f34b50a8b2a825a.zip |
Fix crash on unfound ALSA port.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@2725 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/PatchageCanvas.cpp')
-rw-r--r-- | src/PatchageCanvas.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index d565068..7af0756 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -74,24 +74,25 @@ PatchageCanvas::find_port(const PortID& id) boost::shared_ptr<PatchagePort> pp; #ifdef USE_LIBJACK - assert(id.type == PortID::JACK_ID); // Alsa ports are always indexed + // Alsa ports are always indexed (or don't exist at all) + if (id.type == PortID::JACK_ID) { + jack_port_t* jack_port = jack_port_by_id(_app->jack_driver()->client(), id.id.jack_id); + if (!jack_port) + return boost::shared_ptr<PatchagePort>(); - jack_port_t* jack_port = jack_port_by_id(_app->jack_driver()->client(), id.id.jack_id); - if (!jack_port) - return boost::shared_ptr<PatchagePort>(); - - string module_name; - string port_name; - _app->jack_driver()->port_names(id, module_name, port_name); + string module_name; + string port_name; + _app->jack_driver()->port_names(id, module_name, port_name); - SharedPtr<PatchageModule> module = find_module(module_name, - (jack_port_flags(jack_port) & JackPortIsInput) ? Input : Output); + SharedPtr<PatchageModule> module = find_module( + module_name, (jack_port_flags(jack_port) & JackPortIsInput) ? Input : Output); - if (module) - pp = PtrCast<PatchagePort>(module->get_port(port_name)); + if (module) + pp = PtrCast<PatchagePort>(module->get_port(port_name)); - if (pp) - index_port(id, pp); + if (pp) + index_port(id, pp); + } #endif // USE_LIBJACK return pp; |