diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2019-12-12 14:30:13 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2019-12-12 14:39:03 +0800 |
commit | 50c37ed9869b24b1411d78db764ac519bc7e95e3 (patch) | |
tree | 7f92782d3f116d708e5cc7389dab1075f2e16e34 | |
parent | 371de5132ce6315e0b60cc74ebd47c134c275361 (diff) |
Fixes crash when using Resource::_take_over_path
-rw-r--r-- | core/resource.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/resource.cpp b/core/resource.cpp index e0a40b6f3c..78bc244402 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(); |