From 1a680ddc13517e32c0c658488279a95730dd3348 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 6 Oct 2009 15:54:48 +0000 Subject: more industrial-strength-ifying of io connection name cleanup git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5742 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/mixer_strip.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index d0687485cf..4861efd07c 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -829,7 +829,7 @@ MixerStrip::update_io_button (boost::shared_ptr route, Width widt Port *port; const char **connections; - uint32_t connection_index; + uint32_t connection_index = 0; uint32_t total_connection_count = 0; uint32_t io_connection_count = 0; uint32_t ardour_connection_count = 0; @@ -883,7 +883,10 @@ MixerStrip::update_io_button (boost::shared_ptr route, Width widt if (connection_name.find("ardour:") == 0) { if (ardour_track_name.empty()) { // "ardour:Master/in 1" -> "ardour:Master/" - ardour_track_name = connection_name.substr(0, connection_name.find("/") + 1); + string::size_type slash = connection_name.find("/"); + if (slash != string::npos) { + ardour_track_name = connection_name.substr(0, slash + 1); + } } if (connection_name.find(ardour_track_name) == 0) { @@ -943,8 +946,11 @@ MixerStrip::update_io_button (boost::shared_ptr route, Width widt if ((total_connection_count == ardour_connection_count)) { // all connections are to the same track in ardour // "ardour:Master/" -> "Master" - label << ardour_track_name.substr(7, ardour_track_name.find("/") - 7); - have_label = true; + string::size_type slash = ardour_track_name.find("/"); + if (slash != string::npos) { + label << ardour_track_name.substr(7, slash - 7); + have_label = true; + } } else if (total_connection_count == system_connection_count) { // all connections are to system ports -- cgit v1.2.3