Explorar el Código

Fixes crash when using Resource::_take_over_path

Haoyu Qiu hace 5 años
padre
commit
50c37ed986
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  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) {
 
 			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();