summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2017-11-20 16:27:27 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2017-11-20 16:27:27 -0600
commit29b89434f4db7b6fa5805bd7f8ece491ed83dfbf (patch)
treeb8392e3e2a76ba5c39184b2b72e03214f5766863
parent530fd47a29c5e9f8fcfb578a1685a991c7b355ac (diff)
downloadhorizon-qt5-29b89434f4db7b6fa5805bd7f8ece491ed83dfbf.tar.gz
horizon-qt5-29b89434f4db7b6fa5805bd7f8ece491ed83dfbf.tar.bz2
horizon-qt5-29b89434f4db7b6fa5805bd7f8ece491ed83dfbf.tar.xz
horizon-qt5-29b89434f4db7b6fa5805bd7f8ece491ed83dfbf.zip
Wizard: Harden 'Help' against std::out_of_range
-rw-r--r--horizonwizard.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/horizonwizard.cc b/horizonwizard.cc
index 75a5e8c..53b40b5 100644
--- a/horizonwizard.cc
+++ b/horizonwizard.cc
@@ -1,7 +1,9 @@
#include "horizonwizard.hh"
#include "horizonhelpwindow.hh"
+#include <QDebug>
#include <QFile>
+#include <QMessageBox>
#include <map>
#include <string>
@@ -50,6 +52,17 @@ HorizonWizard::HorizonWizard(QWidget *parent) : QWizard(parent)
QObject::connect(this, (void (QWizard:: *)(void))&QWizard::helpRequested,
[=](void) {
+ if(help_id_map.find(currentId()) == help_id_map.end())
+ {
+ qDebug() << "no help available for " << currentId();
+ QMessageBox nohelp(QMessageBox::Warning,
+ tr("No Help Available"),
+ tr("Help is not available for the current page. Consult the Installation Guide for more information."),
+ QMessageBox::Ok,
+ this);
+ nohelp.exec();
+ return;
+ }
string helppath = ":/wizard_help/resources/" +
help_id_map.at(currentId()) + "-help.txt";
QFile helpfile(helppath.c_str());