Make ardour not crash if a region state cannot be loaded (for example

due to a missing source descriptor in the XML).


git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2913 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sampo Savolainen 2008-01-14 17:49:30 +00:00
parent 22662f9dde
commit cc607b9fb9
2 changed files with 11 additions and 2 deletions

View file

@ -2571,7 +2571,9 @@ Session::add_region (boost::shared_ptr<Region> region)
{
Glib::Mutex::Lock lm (region_lock);
if ((ar = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
if (region == 0) {
error << _("Session::add_region() ignored a null region. Warning: you might have lost a region.") << endmsg;
} else if ((ar = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
AudioRegionList::iterator x;

View file

@ -1391,7 +1391,14 @@ Session::load_regions (const XMLNode& node)
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((region = XMLRegionFactory (**niter, false)) == 0) {
error << _("Session: cannot create Region from XML description.") << endmsg;
error << _("Session: cannot create Region from XML description.");
const XMLProperty *name = (**niter).property("name");
if (name) {
error << " " << string_compose (_("Can not load state for region '%1'"), name->value());
}
error << endmsg;
}
}