Bug report refers to a more thorough patch #3972 which seems to have never been accepted. All I'm trying to do here is add the file_exists check which fixes the hanging while minimising the changes needed.

(MSVC debug mode still fails due to a vector assertion failure (teams vector reference), which makes testing/debugging the editor difficult.)

If anyone feels like adding all the error messages/handling included from the patch, go right ahead.
This commit is contained in:
Wedge009 2015-10-13 21:45:45 +11:00 committed by Ignacio R. Morelle
parent 947266de18
commit a490c514d3

View file

@ -36,20 +36,23 @@ EXIT_STATUS start(const config& game_conf, CVideo& video, const std::string& fil
hotkey::set_scope_active(hotkey::SCOPE_GENERAL);
hotkey::set_scope_active(hotkey::SCOPE_EDITOR);
editor_controller editor(game_conf, video);
if (!filename.empty()) {
if (!filename.empty() && filesystem::file_exists (filename)) {
if (filesystem::is_directory(filename)) {
editor.context_manager_->set_default_dir(filename);
editor.context_manager_->load_map_dialog(true);
} else {
editor.context_manager_->load_map(filename, false);
}
if (take_screenshot) {
editor.do_screenshot(screenshot_filename);
e = EXIT_NORMAL;
}
}
if(take_screenshot) {
editor.do_screenshot(screenshot_filename);
e = EXIT_NORMAL;
} else {
if (!take_screenshot)
e = editor.main_loop();
}
} catch (editor_exception& e) {
ERR_ED << "Editor exception in editor::start: " << e.what() << "\n";
throw;