From 295f361f5eaa2c42f7c5bba0001e465c2ffdc340 Mon Sep 17 00:00:00 2001 From: GZharun Date: Sun, 31 Aug 2014 13:05:42 +0300 Subject: [PATCH] [Summary] Fixed issue with crash when invalid get_connections request is made on invalid port handle. get_connections() method is expected to return the amount of found connections. When port handle is invalid it returns -1 indicating an error. if (_io->nth (n)->get_connections (connections) == 0) { if (!(*chan)->source.name.empty()) { // _source->disable_metering (); } (*chan)->source.name = string(); } else { (*chan)->source.name = connections[0]; } -1 is the case which is not handled correctly here. --- libs/ardour/port.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index 19bebd103f..e3664874b9 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -135,7 +135,12 @@ Port::get_connections (std::vector & c) const return c.size(); } - return port_engine.get_connections (_port_handle, c); + if (_port_handle) { + port_engine.get_connections (_port_handle, c); + return c.size(); + } + + return 0; } int