+ do not always close a document if an error occurs while reading it in

This commit is contained in:
wmayer 2016-05-30 18:58:06 +02:00
parent affbed135a
commit 76548e987d

View File

@ -30,6 +30,7 @@
# include <iostream>
# include <sstream>
# include <exception>
# include <ios>
# if defined(FC_OS_LINUX) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD)
# include <unistd.h>
# include <pwd.h>
@ -442,10 +443,21 @@ Document* Application::openDocument(const char * FileName)
newDoc->restore();
return newDoc;
}
catch (...) {
// if the project file itself is corrupt then
// close the document
catch (const Base::FileException&) {
closeDocument(newDoc->getName());
throw;
}
catch (const std::ios_base::failure&) {
closeDocument(newDoc->getName());
throw;
}
// but for any other exceptions leave it open to give the
// user a chance to fix it
catch (...) {
throw;
}
}
Document* Application::getActiveDocument(void) const