|
1 | | -#include "mainwindow.h" |
2 | 1 | #include <Poco/Exception.h> |
| 2 | +#include <sys/stat.h> |
3 | 3 | #include <QApplication> |
| 4 | +#include <QMessageBox> |
4 | 5 | #include <QSettings> |
5 | | -#include <sys/stat.h> |
| 6 | +#include "mainwindow.h" |
6 | 7 |
|
7 | 8 | #ifdef OPTION_INCLUDE_CRASHCPP |
8 | 9 | #include <crashcpp/crashcpp.h> |
@@ -43,15 +44,28 @@ int main(int argc, char *argv[]) { |
43 | 44 | QString lastProjPath = settings.value("LastProjectPath", "").toString(); |
44 | 45 |
|
45 | 46 | // check if path was stored previously |
46 | | - if (!lastProjPath.isEmpty()) { |
47 | | - // check if file exists on fs |
48 | | - struct stat buffer; |
49 | | - if (stat(lastProjPath.toStdString().c_str(), &buffer) == 0) |
50 | | - w.openProject(AnnotatorLib::Project::load(lastProjPath.toStdString())); |
| 47 | + try { |
| 48 | + if (!lastProjPath.isEmpty()) { |
| 49 | + // check if file exists on fs |
| 50 | + struct stat buffer; |
| 51 | + if (stat(lastProjPath.toStdString().c_str(), &buffer) == 0) |
| 52 | + w.openProject(AnnotatorLib::Project::load(lastProjPath.toStdString())); |
| 53 | + } |
| 54 | + } catch (Poco::Exception &e) { |
| 55 | + QMessageBox::critical( |
| 56 | + nullptr, "Critical error while loading last session.", |
| 57 | + "Last session coult not been loaded causing following error: " + |
| 58 | + QString::fromStdString(e.message())); |
| 59 | + } catch (std::exception &e) { |
| 60 | + QMessageBox::critical( |
| 61 | + nullptr, "Critical error while loading last session.", |
| 62 | + "Last session coult not been loaded causing following error: " + |
| 63 | + QString::fromStdString(e.what())); |
51 | 64 | } |
52 | 65 |
|
53 | 66 | /* |
54 | | - * If an unhandled exception occurs, the exception will be sent to crashcpp.chriamue.de |
| 67 | + * If an unhandled exception occurs, the exception will be sent to |
| 68 | + * crashcpp.chriamue.de |
55 | 69 | */ |
56 | 70 | try { |
57 | 71 | return a.exec(); |
|
0 commit comments