Fix crash when loading broken sessions with invalid route IDs.
authorDavid Robillard <d@drobilla.net>
Tue, 9 Jun 2009 21:17:12 +0000 (21:17 +0000)
committerDavid Robillard <d@drobilla.net>
Tue, 9 Jun 2009 21:17:12 +0000 (21:17 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5139 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/session_command.cc

index cf9cd6f7c904499c1a89ab34c831b5b37c61f637..828daf37bb93d509a24c9208c7bc197ca8696aec 100644 (file)
@@ -103,7 +103,9 @@ Session::memento_command_factory(XMLNode *n)
                    return new MementoCommand<Playlist>(*(pl.get()), before, after);
            }
     } else if (obj_T == typeid (Route).name() || obj_T == typeid (AudioTrack).name() || obj_T == typeid(MidiTrack).name()) { 
-           return new MementoCommand<Route>(*route_by_id(id), before, after);
+               if (boost::shared_ptr<Route> r = route_by_id(id)) {
+                       return new MementoCommand<Route>(*r, before, after);
+               }
     } else if (obj_T == typeid (Evoral::Curve).name() || obj_T == typeid (AutomationList).name()) {
                std::map<PBD::ID, AutomationList*>::iterator i = automation_lists.find(id);
                if (i != automation_lists.end()) {