Skip to content

Commit

Permalink
+ do not always close a document if an error occurs while reading it in
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed May 30, 2016
1 parent affbed1 commit 76548e9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/App/Application.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 76548e9

Please sign in to comment.