From: Christoph Egger Date: Fri, 15 May 2015 23:25:20 +0000 (+0200) Subject: Handle cancel on InterpreterMenu X-Git-Tag: v0.2~30 X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=commitdiff_plain;h=85d67be4869bd6a274e009af63fc6955c5e6d37a;hp=6d0838cec0411286de35e5a22a042d9a3b1eebf7 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 --- 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();