diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 08f50218891..58ab9a8cde4 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -147,8 +147,8 @@ Ref Resource::duplicate_for_local_scene(Node *p_for_scene, Map plist; get_property_list(&plist); - Resource *r = Object::cast_to(ClassDB::instance(get_class())); - ERR_FAIL_COND_V(!r, Ref()); + Ref r = Object::cast_to(ClassDB::instance(get_class())); + ERR_FAIL_COND_V(r.is_null(), Ref()); r->local_scene = p_for_scene; @@ -175,9 +175,7 @@ Ref Resource::duplicate_for_local_scene(Node *p_for_scene, Mapset(E->get().name, p); } - RES res = Ref(r); - - return res; + return r; } void Resource::configure_for_local_scene(Node *p_for_scene, Map, Ref> &remap_cache) {