Fixes crash when using Resource::_take_over_path

This commit is contained in:
Haoyu Qiu 2019-12-12 14:30:13 +08:00
parent 371de5132c
commit 50c37ed986

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