diff options
author | Saracen <SaracenOne@gmail.com> | 2023-09-26 03:07:43 +0100 |
---|---|---|
committer | Saracen <SaracenOne@gmail.com> | 2023-09-26 03:07:43 +0100 |
commit | 3f4513d4deaa9eed192fe13b6ce5ad9cb6751917 (patch) | |
tree | 481e7342720add932d55bd8f9558ca97b4fa1541 /main/main.cpp | |
parent | 43b9e89a07bb0926fb66bddbf98981d25a5cccee (diff) | |
download | redot-engine-3f4513d4deaa9eed192fe13b6ce5ad9cb6751917.tar.gz |
Add error checks for DirAccess creation.
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index cd9bd6d1d3..990ef4133a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2224,6 +2224,8 @@ Error Main::setup2() { // Editor setting class is not available, load config directly. if (!init_use_custom_screen && (editor || project_manager) && EditorPaths::get_singleton()->are_paths_valid()) { Ref<DirAccess> dir = DirAccess::open(EditorPaths::get_singleton()->get_config_dir()); + ERR_FAIL_COND_V(dir.is_null(), FAILED); + String config_file_name = "editor_settings-" + itos(VERSION_MAJOR) + ".tres"; String config_file_path = EditorPaths::get_singleton()->get_config_dir().path_join(config_file_name); if (dir->file_exists(config_file_name)) { @@ -3295,6 +3297,8 @@ bool Main::start() { if (sep == -1) { Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + ERR_FAIL_COND_V(da.is_null(), false); + local_game_path = da->get_current_dir().path_join(local_game_path); } else { Ref<DirAccess> da = DirAccess::open(local_game_path.substr(0, sep)); |