From 85d67be4869bd6a274e009af63fc6955c5e6d37a Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Sat, 16 May 2015 01:25:20 +0200 Subject: [PATCH] Handle cancel on InterpreterMenu getOpenFileName() will return a Null-QString on cancel. Feeding that filename to guile will die (reasonably) with an exception. Instead, we now just exit from the handler in the gui if the Null-QString is returned Closes T33 --- src/gui/Mainwindow.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 7ea9012..544d5fd 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -58,9 +58,11 @@ Mainwindow::Mainwindow(InformationManager* mgr) QString fileName = QFileDialog::getOpenFileName(this, tr("Open Script"), "", tr("Binaries") + " (*." + manager->getInterpreter("GUILE")->fileExtension().c_str() + ")"); - std::stringstream a, b; - std::string c; - manager->getInterpreter("GUILE")->loadFile(fileName.toStdString(), a, b, c); + if(! fileName.isNull()) { + std::stringstream a, b; + std::string c; + manager->getInterpreter("GUILE")->loadFile(fileName.toStdString(), a, b, c); + } }); listWidget = new QTreeWidget(); -- 2.39.5