Resolve Bug #20900
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:
parent
b876247051
commit
2bb13fe9e3
1 changed files with 9 additions and 6 deletions
|
@ -35,20 +35,23 @@ EXIT_STATUS start(const config& game_conf, CVideo& video, const std::string& fil
|
|||
hotkey::deactivate_all_scopes();
|
||||
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() << std::endl;
|
||||
throw;
|
||||
|
|
Loading…
Add table
Reference in a new issue