+ do not always close a document if an error occurs while reading it in
This commit is contained in:
parent
affbed135a
commit
76548e987d
|
@ -30,6 +30,7 @@
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
# include <exception>
|
# include <exception>
|
||||||
|
# include <ios>
|
||||||
# if defined(FC_OS_LINUX) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD)
|
# if defined(FC_OS_LINUX) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
|
@ -442,10 +443,21 @@ Document* Application::openDocument(const char * FileName)
|
||||||
newDoc->restore();
|
newDoc->restore();
|
||||||
return newDoc;
|
return newDoc;
|
||||||
}
|
}
|
||||||
catch (...) {
|
// if the project file itself is corrupt then
|
||||||
|
// close the document
|
||||||
|
catch (const Base::FileException&) {
|
||||||
closeDocument(newDoc->getName());
|
closeDocument(newDoc->getName());
|
||||||
throw;
|
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
|
Document* Application::getActiveDocument(void) const
|
||||||
|
|
Loading…
Reference in New Issue
Block a user