summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2024-08-13 12:52:08 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2024-08-13 12:52:08 +0200
commit31a9e10ddb37f7b5c8697c24ba02ce7bd7a1305a (patch)
treec36231ba10bfcb378683af6cc786b11346832d97
parenta7a124a57d643103c882a781dfe1f3772363ecc7 (diff)
downloadredot-engine-31a9e10ddb37f7b5c8697c24ba02ce7bd7a1305a.tar.gz
ResourceLoader: Use better error handling for possible engine bugs
-rw-r--r--core/io/resource_loader.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index c5582ad231..1e5afe57fc 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -581,13 +581,7 @@ ResourceLoader::ThreadLoadStatus ResourceLoader::load_threaded_get_status(const
}
String local_path = _validate_local_path(p_path);
- if (!thread_load_tasks.has(local_path)) {
-#ifdef DEV_ENABLED
- CRASH_NOW();
-#endif
- // On non-dev, be defensive and at least avoid crashing (at this point at least).
- return THREAD_LOAD_INVALID_RESOURCE;
- }
+ ERR_FAIL_COND_V_MSG(!thread_load_tasks.has(local_path), THREAD_LOAD_INVALID_RESOURCE, "Bug in ResourceLoader logic, please report.");
ThreadLoadTask &load_task = thread_load_tasks[local_path];
status = load_task.status;
@@ -676,14 +670,10 @@ Ref<Resource> ResourceLoader::_load_complete_inner(LoadToken &p_load_token, Erro
if (!p_load_token.local_path.is_empty()) {
if (!thread_load_tasks.has(p_load_token.local_path)) {
-#ifdef DEV_ENABLED
- CRASH_NOW();
-#endif
- // On non-dev, be defensive and at least avoid crashing (at this point at least).
if (r_error) {
*r_error = ERR_BUG;
}
- return Ref<Resource>();
+ ERR_FAIL_V_MSG(Ref<Resource>(), "Bug in ResourceLoader logic, please report.");
}
ThreadLoadTask &load_task = thread_load_tasks[p_load_token.local_path];