Browse Source

Fixes crash when using Resource::_take_over_path

Haoyu Qiu 5 years ago
parent
commit
50c37ed986
1 changed files with 4 additions and 1 deletions
  1. 4 1
      core/resource.cpp

+ 4 - 1
core/resource.cpp

@@ -68,7 +68,10 @@ void Resource::set_path(const String &p_path, bool p_take_over) {
 		if (p_take_over) {
 		if (p_take_over) {
 
 
 			ResourceCache::lock->write_lock();
 			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();
 			ResourceCache::lock->write_unlock();
 		} else {
 		} else {
 			ResourceCache::lock->read_lock();
 			ResourceCache::lock->read_lock();