From 29b89434f4db7b6fa5805bd7f8ece491ed83dfbf Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 20 Nov 2017 16:27:27 -0600 Subject: Wizard: Harden 'Help' against std::out_of_range --- horizonwizard.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 #include +#include #include #include @@ -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()); -- cgit v1.2.3-60-g2f50