From 97273ce37889d25a8959086fc0a46099d901b2fa Mon Sep 17 00:00:00 2001 From: Tomasz Chabora Date: Wed, 8 Jan 2020 15:11:16 +0100 Subject: [PATCH] Check if resource exists before loading --- core/io/resource_loader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 5d856348958..7471ab42412 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -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 + "."); +#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 + "."); }