Skip to content

Commit

Permalink
Merge pull request #43657 from RandomShaper/fix_dupe_crash
Browse files Browse the repository at this point in the history
Fix crash duplicating local-to-scene resources
  • Loading branch information
akien-mga authored Nov 19, 2020
2 parents a3a3b02 + e99cf6b commit eebd3e8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/io/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
List<PropertyInfo> plist;
get_property_list(&plist);

Resource *r = Object::cast_to<Resource>(ClassDB::instance(get_class()));
ERR_FAIL_COND_V(!r, Ref<Resource>());
Ref<Resource> r = Object::cast_to<Resource>(ClassDB::instance(get_class()));
ERR_FAIL_COND_V(r.is_null(), Ref<Resource>());

r->local_scene = p_for_scene;

Expand All @@ -175,9 +175,7 @@ Ref<Resource> Resource::duplicate_for_local_scene(Node *p_for_scene, Map<Ref<Res
r->set(E->get().name, p);
}

RES res = Ref<Resource>(r);

return res;
return r;
}

void Resource::configure_for_local_scene(Node *p_for_scene, Map<Ref<Resource>, Ref<Resource>> &remap_cache) {
Expand Down

0 comments on commit eebd3e8

Please sign in to comment.