Skip to content
Snippets Groups Projects
Commit f3ffae1a authored by Andre Offringa's avatar Andre Offringa
Browse files

Task #1892: giving proper error box when opening a strategy fails (after...

Task #1892: giving proper error box when opening a strategy fails (after feedback from Arpad Miskolczi)
parent 05fd4aa7
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <iostream> #include <iostream>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <gtkmm/messagedialog.h>
#include <AOFlagger/strategy/actions/iterationaction.h> #include <AOFlagger/strategy/actions/iterationaction.h>
#include <AOFlagger/strategy/actions/strategyaction.h> #include <AOFlagger/strategy/actions/strategyaction.h>
...@@ -517,11 +518,17 @@ void EditStrategyWindow::onOpenClicked() ...@@ -517,11 +518,17 @@ void EditStrategyWindow::onOpenClicked()
StrategyReader reader; StrategyReader reader;
std::string filename(dialog.get_filename()); std::string filename(dialog.get_filename());
Strategy *oldStrategy = _strategy; Strategy *oldStrategy = _strategy;
_strategy = reader.CreateStrategyFromFile(filename); try {
_msWindow.SetStrategy(_strategy); _strategy = reader.CreateStrategyFromFile(filename);
delete oldStrategy; _msWindow.SetStrategy(_strategy);
_store->clear(); delete oldStrategy;
fillStore(); _store->clear();
fillStore();
} catch(std::exception &e)
{
Gtk::MessageDialog dialog(*this, e.what(), false, Gtk::MESSAGE_ERROR);
dialog.run();
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment