@@ -750,7 +750,7 @@ Error ResourceLoaderBinary::load() {
750750 Ref<Resource> res;
751751 Resource *r = nullptr ;
752752
753- MissingResource * missing_resource = nullptr ;
753+ Ref< MissingResource> missing_resource;
754754
755755 if (main) {
756756 res = ResourceLoader::get_resource_ref_override (local_path);
@@ -776,7 +776,7 @@ Error ResourceLoaderBinary::load() {
776776 missing_resource = memnew (MissingResource);
777777 missing_resource->set_original_class (t);
778778 missing_resource->set_recording_properties (true );
779- obj = missing_resource;
779+ obj = missing_resource. ptr () ;
780780 } else {
781781 error = ERR_FILE_CORRUPT ;
782782 ERR_FAIL_V_MSG (ERR_FILE_CORRUPT , vformat (" '%s': Resource of unrecognized type in file: '%s'." , local_path, t));
@@ -832,7 +832,7 @@ Error ResourceLoaderBinary::load() {
832832 }
833833
834834 bool set_valid = true ;
835- if (value.get_type () == Variant::OBJECT && missing_resource == nullptr && ResourceLoader::is_creating_missing_resources_if_class_unavailable_enabled ()) {
835+ if (value.get_type () == Variant::OBJECT && missing_resource. is_null () && ResourceLoader::is_creating_missing_resources_if_class_unavailable_enabled ()) {
836836 // If the property being set is a missing resource (and the parent is not),
837837 // then setting it will most likely not work.
838838 // Instead, save it as metadata.
@@ -874,7 +874,7 @@ Error ResourceLoaderBinary::load() {
874874 }
875875 }
876876
877- if (missing_resource) {
877+ if (missing_resource. is_valid () ) {
878878 missing_resource->set_recording_properties (false );
879879 }
880880
0 commit comments