From 9450717571c1b1cd43be5b188e55442dcd412c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Tue, 17 Nov 2020 10:13:41 +0100 Subject: Fix crash in resoure duplicate --- core/io/resource.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 5b249f7af3..08f5021889 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -209,8 +209,8 @@ Ref Resource::duplicate(bool p_subresources) const { List plist; get_property_list(&plist); - Resource *r = (Resource *)ClassDB::instance(get_class()); - ERR_FAIL_COND_V(!r, Ref()); + Ref r = (Resource *)ClassDB::instance(get_class()); + ERR_FAIL_COND_V(r.is_null(), Ref()); for (List::Element *E = plist.front(); E; E = E->next()) { if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) { @@ -230,7 +230,7 @@ Ref Resource::duplicate(bool p_subresources) const { } } - return Ref(r); + return r; } void Resource::_set_path(const String &p_path) { -- cgit v1.2.3