don't crash if history refers to a location that no longer exists
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 17 Jan 2008 03:16:41 +0000 (03:16 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 17 Jan 2008 03:16:41 +0000 (03:16 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2929 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/session_command.cc

index b9a0e2cb6009b8786d5988afd105643af164cae1..687e10f789b19f8c7d661df8824a4bb2247580f0 100644 (file)
@@ -86,7 +86,10 @@ Session::memento_command_factory(XMLNode *n)
            if (audio_sources.count(id))
                    return new MementoCommand<AudioSource>(*audio_sources[id], before, after);
     } else if (obj_T == typeid (Location).name()) {
-           return new MementoCommand<Location>(*_locations.get_location_by_id(id), before, after);
+           Location* loc = _locations.get_location_by_id(id);
+           if (loc) {
+                   return new MementoCommand<Location>(*loc, before, after);
+           }
     } else if (obj_T == typeid (Locations).name()) {
            return new MementoCommand<Locations>(_locations, before, after);
     } else if (obj_T == typeid (TempoMap).name()) {