Merge pull request #34296 from timothyqiu/lock-33072

Fixes crash when using Resource::_take_over_path
This commit is contained in:
Rémi Verschelde 2020-01-06 14:04:23 +01:00 committed by GitHub
commit e62941fb53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();