summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-06 14:04:23 +0100
committerGitHub <noreply@github.com>2020-01-06 14:04:23 +0100
commite62941fb5317cffd8f4173da287fd204ee8131e0 (patch)
treed840abfacd6cb5afa44950b5ccae06df434e1507
parent080e6e48ad0bdab8385e6ec3fc4636fc86a4b4a7 (diff)
parent50c37ed9869b24b1411d78db764ac519bc7e95e3 (diff)
Merge pull request #34296 from timothyqiu/lock-33072
Fixes crash when using Resource::_take_over_path
-rw-r--r--core/resource.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/resource.cpp b/core/resource.cpp
index 1c9d3f8d49..30e09716aa 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -68,7 +68,10 @@ void Resource::set_path(const String &p_path, bool p_take_over) {
if (p_take_over) {
ResourceCache::lock->write_lock();
- ResourceCache::resources.get(p_path)->set_name("");
+ Resource **res = ResourceCache::resources.getptr(p_path);
+ if (res) {
+ (*res)->set_name("");
+ }
ResourceCache::lock->write_unlock();
} else {
ResourceCache::lock->read_lock();