aboutsummaryrefslogtreecommitdiff
path: root/src/main_window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_window.cc')
-rw-r--r--src/main_window.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main_window.cc b/src/main_window.cc
index ad3a7fe..dbe82a9 100644
--- a/src/main_window.cc
+++ b/src/main_window.cc
@@ -12,7 +12,6 @@ MainWindow::MainWindow(QWidget *parent) {
(void) parent;
connect(&glw, &OpenGLWidget::initialized,
this, &MainWindow::onOpenGLWidgetInitialized);
- // connect(&timer, &QTimer::timeout, this, &MainWindow::step);
setCentralWidget(&glw);
addToolBar(Qt::TopToolBarArea, &top_tb);
open_action = top_tb.addAction("Ouvrir…", [&]() {
@@ -59,7 +58,12 @@ void MainWindow::open(const QString &path) {
return;
}
QByteArray data = file.readAll();
- QJsonDocument json_doc = QJsonDocument::fromJson(data);
+ QJsonParseError error;
+ QJsonDocument json_doc = QJsonDocument::fromJson(data, &error);
+ if (error.error != QJsonParseError::NoError) {
+ qWarning() << "Erreur lors de la lecture du ficher JSON:" << error.errorString();
+ return;
+ }
if (dc) delete dc;
glw.meshes.clear();
dc = new DroneController(json_doc.object());