diff --git a/lib/config.cc b/lib/config.cc index b4270ee4..86880c4d 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -442,7 +442,7 @@ void Config::clearOptions() invalidate(); } -static void setFluxSourceImpl(std::string filename, FluxSourceProto* proto) +static void setFluxSourceImpl(const std::string& filename, FluxSourceProto* proto) { for (const auto& it : fluxConstructors) { @@ -464,7 +464,7 @@ void Config::setFluxSource(std::string filename) setFluxSourceImpl(filename, overrides()->mutable_flux_source()); } -static void setFluxSinkImpl(std::string filename, FluxSinkProto* proto) +static void setFluxSinkImpl(const std::string& filename, FluxSinkProto* proto) { for (const auto& it : fluxConstructors) { diff --git a/src/gui/idlepanel.cc b/src/gui/idlepanel.cc index 69194c0d..31748b89 100644 --- a/src/gui/idlepanel.cc +++ b/src/gui/idlepanel.cc @@ -224,8 +224,23 @@ public: case SELECTEDSOURCE_FLUX: { - globalConfig().setFluxSink(_selectedFluxfilename); - globalConfig().setFluxSource(_selectedFluxfilename); + try + { + globalConfig().setFluxSink(_selectedFluxfilename); + } + catch (const InapplicableValueException* e) + { + /* ignore */ + } + + try + { + globalConfig().setFluxSource(_selectedFluxfilename); + } + catch (const InapplicableValueException* e) + { + /* ignore */ + } break; } @@ -587,12 +602,12 @@ private: /* The current set of options is invalid for some reason. Just * swallow the errors. */ } - catch (const ErrorException& e) - { - /* This really isn't supposed to happen, but sometimes does and - * it crashes the whole program. */ - return; - } + catch (const ErrorException& e) + { + /* This really isn't supposed to happen, but sometimes does and + * it crashes the whole program. */ + return; + } assert(!wxGetApp().IsWorkerThreadRunning()); diff --git a/src/gui/main.cc b/src/gui/main.cc index 44a40455..f4817631 100644 --- a/src/gui/main.cc +++ b/src/gui/main.cc @@ -53,11 +53,19 @@ private: bool FluxEngineApp::OnInit() { + try + { wxImage::AddHandler(new wxPNGHandler()); Bind(EXEC_EVENT_TYPE, &FluxEngineApp::OnExec, this); _mainWindow = CreateMainWindow(); _mainWindow->Show(true); return true; + } + catch (const ErrorException* e) + { + fmt::print(stderr, "Exception on startup: {}\n", e->message); + exit(1); + } } wxThread::ExitCode FluxEngineApp::Entry()