From: Christoph Egger Date: Fri, 23 May 2014 16:33:45 +0000 (+0200) Subject: Also handle case with no filename provided X-Git-Tag: v0.1~206 X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=commitdiff_plain;h=516e590392ed1f4ead816731bfd95fc3c4690b9f Also handle case with no filename provided --- diff --git a/src/main.cxx b/src/main.cxx index 74d1325..80e06ce 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -18,6 +18,8 @@ using std::cerr; int main(int argc, char** argv) { + QApplication app(argc, argv); + log4cxx::BasicConfigurator::configure(); log4cxx::LoggerPtr _logger(log4cxx::Logger::getLogger("main")); @@ -28,7 +30,7 @@ int main(int argc, char** argv) parser.addVersionOption(); parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble.")); - QApplication app(argc, argv); + parser.process(app); LOG4CXX_DEBUG(_logger, "Initializing LLVM"); @@ -39,8 +41,14 @@ int main(int argc, char** argv) LOG4CXX_DEBUG(_logger, "Initializing Qt"); - Mainwindow m(parser.positionalArguments().at(0).toStdString()); - m.show(); + std::string filename; + if (parser.positionalArguments().isEmpty()) { + filename = ""; + } else { + filename = parser.positionalArguments().at(0).toStdString(); + } - return app.exec(); + Mainwindow m(filename); + m.show(); + return app.exec(); }