You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Check if resource exists before loading
This commit is contained in:
@@ -277,6 +277,11 @@ RES ResourceLoader::_load(const String &p_path, const String &p_original_path, c
|
|||||||
|
|
||||||
ERR_FAIL_COND_V_MSG(found, RES(), "Failed loading resource: " + p_path + ".");
|
ERR_FAIL_COND_V_MSG(found, RES(), "Failed loading resource: " + p_path + ".");
|
||||||
|
|
||||||
|
#ifdef TOOLS_ENABLED
|
||||||
|
FileAccessRef file_check = FileAccess::create(FileAccess::ACCESS_RESOURCES);
|
||||||
|
ERR_FAIL_COND_V_MSG(!file_check->file_exists(p_path), RES(), "Resource file not found: " + p_path + ".");
|
||||||
|
#endif
|
||||||
|
|
||||||
ERR_FAIL_V_MSG(RES(), "No loader found for resource: " + p_path + ".");
|
ERR_FAIL_V_MSG(RES(), "No loader found for resource: " + p_path + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user