summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-23 09:41:59 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-23 09:41:59 +0200
commit414dd3a25708e5cf51d28fa8b039ce0d5ad3e1f5 (patch)
tree7bdd5abbbf0864c709e948d34f38c9a3b0f8adf8 /core/io
parent62792eeb9fac4f44272f59f95ec8eb3abc0432a7 (diff)
parent2175e38dfba61b714456abfa4d40e4c015369271 (diff)
Merge pull request #66246 from Jummit/fix-dir-crash
Fix crash when listing files in nonexistent directory
Diffstat (limited to 'core/io')
-rw-r--r--core/io/dir_access.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/io/dir_access.cpp b/core/io/dir_access.cpp
index f86dfe8057..79e7fa16e3 100644
--- a/core/io/dir_access.cpp
+++ b/core/io/dir_access.cpp
@@ -492,6 +492,7 @@ PackedStringArray DirAccess::get_files() {
PackedStringArray DirAccess::get_files_at(const String &p_path) {
Ref<DirAccess> da = DirAccess::open(p_path);
+ ERR_FAIL_COND_V_MSG(da.is_null(), PackedStringArray(), vformat("Couldn't open directory at path \"%s\".", p_path));
return da->get_files();
}
@@ -501,6 +502,7 @@ PackedStringArray DirAccess::get_directories() {
PackedStringArray DirAccess::get_directories_at(const String &p_path) {
Ref<DirAccess> da = DirAccess::open(p_path);
+ ERR_FAIL_COND_V_MSG(da.is_null(), PackedStringArray(), vformat("Couldn't open directory at path \"%s\".", p_path));
return da->get_directories();
}