Prevent crash when trying to register a port with a disconnected engine.
authorCarl Hetherington <carl@carlh.net>
Wed, 27 Oct 2010 21:18:18 +0000 (21:18 +0000)
committerCarl Hetherington <carl@carlh.net>
Wed, 27 Oct 2010 21:18:18 +0000 (21:18 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7925 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/port.cc

index efdd297f5e9bd531f5efa84e28a88f132d6048fc..4ae9b03c3b88b11db4d54f0744baee4e40683049 100644 (file)
@@ -51,6 +51,10 @@ Port::Port (std::string const & n, DataType t, Flags f)
 
        assert (_name.find_first_of (':') == std::string::npos);
 
+       if (!_engine->connected()) {
+               throw failed_constructor ();
+       }
+
        if ((_jack_port = jack_port_register (_engine->jack (), _name.c_str (), t.to_jack_type (), _flags, 0)) == 0) {
                throw failed_constructor ();
        }