Hopefully fix crash with empty IO matrix bundles
authorCarl Hetherington <carl@carlh.net>
Fri, 19 Aug 2011 14:45:08 +0000 (14:45 +0000)
committerCarl Hetherington <carl@carlh.net>
Fri, 19 Aug 2011 14:45:08 +0000 (14:45 +0000)
(#4270).

git-svn-id: svn://localhost/ardour2/branches/3.0@10009 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/bundle_manager.cc
gtk2_ardour/io_selector.cc

index 2e85b6a0300aceb9a627e3e084142e941744056f..6367eb6560d0f30058f082de86d616421dd03ba8 100644 (file)
@@ -82,6 +82,10 @@ BundleEditorMatrix::set_state (BundleChannel c[2], bool s)
 PortMatrixNode::State
 BundleEditorMatrix::get_state (BundleChannel c[2]) const
 {
+       if (c[0].bundle->nchannels() == ChanCount::ZERO || c[1].bundle->nchannels() == ChanCount::ZERO) {
+               return PortMatrixNode::NOT_ASSOCIATED;
+       }
+
        Bundle::PortList const& pl = c[OTHER].bundle->channel_ports (c[OTHER].channel);
        if (pl.empty ()) {
                return PortMatrixNode::NOT_ASSOCIATED;
index 8b47c46f39b56570259ab25f72e9dd5bcf1a2b7b..b9e19de7adb867df65427576e7b99bfc6c4ef9f0 100644 (file)
@@ -156,6 +156,10 @@ IOSelector::set_state (ARDOUR::BundleChannel c[2], bool s)
 PortMatrixNode::State
 IOSelector::get_state (ARDOUR::BundleChannel c[2]) const
 {
+       if (c[0].bundle->nchannels() == ChanCount::ZERO || c[1].bundle->nchannels() == ChanCount::ZERO) {
+               return PortMatrixNode::NOT_ASSOCIATED;
+       }
+
        ARDOUR::Bundle::PortList const & our_ports = c[_ours].bundle->channel_ports (c[_ours].channel);
        ARDOUR::Bundle::PortList const & other_ports = c[_other].bundle->channel_ports (c[_other].channel);