summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-11-17 11:21:53 +0100
committerGitHub <noreply@github.com>2020-11-17 11:21:53 +0100
commit386ee529783adc7e58854019ba608d2821925081 (patch)
tree6e97ef7e161af54a2ff5078581aa4ce93fa1973e /core/io
parent99d0df2e33af09655d92bed0d619b6a8f93183ae (diff)
parent9450717571c1b1cd43be5b188e55442dcd412c51 (diff)
Merge pull request #43610 from RandomShaper/fix_res_duplicate
Fix crash in resoure duplicate
Diffstat (limited to 'core/io')
-rw-r--r--core/io/resource.cpp6
1 files 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> Resource::duplicate(bool p_subresources) const {
List<PropertyInfo> plist;
get_property_list(&plist);
- Resource *r = (Resource *)ClassDB::instance(get_class());
- ERR_FAIL_COND_V(!r, Ref<Resource>());
+ Ref<Resource> r = (Resource *)ClassDB::instance(get_class());
+ ERR_FAIL_COND_V(r.is_null(), Ref<Resource>());
for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) {
@@ -230,7 +230,7 @@ Ref<Resource> Resource::duplicate(bool p_subresources) const {
}
}
- return Ref<Resource>(r);
+ return r;
}
void Resource::_set_path(const String &p_path) {