From 76548e987d434467e77d24015f7846e8c700a952 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 30 May 2016 18:58:06 +0200 Subject: [PATCH] + do not always close a document if an error occurs while reading it in --- src/App/Application.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index af237eb1a..79ee1f321 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -30,6 +30,7 @@ # include # include # include +# include # if defined(FC_OS_LINUX) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD) # include # include @@ -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