Catch mapgen errors in editor, fixing bug #13549

This commit is contained in:
Tomasz Śniatowski 2009-05-23 00:12:17 +01:00
parent b22f0d5e98
commit 76dda277a9

View file

@ -487,8 +487,14 @@ void editor_controller::generate_map_dialog()
dialog.set_gui(&gui());
dialog.show(gui().video());
if (dialog.get_retval() == gui2::twindow::OK) {
std::string map_string =
dialog.get_selected_map_generator()->create_map(std::vector<std::string>());
std::string map_string;
try {
map_string = dialog.get_selected_map_generator()
->create_map(std::vector<std::string>());
} catch (mapgen_exception& e) {
gui::message_dialog(gui(), _("Map creation failed."), e.what()).show();
return;
}
if (map_string.empty()) {
gui::message_dialog(gui(), "", _("Map creation failed.")).show();
} else {