[Core,Drivers] Improve use of Ref.is_null/valid

Use `is_null` over `!is_valid` and vice versa.
This commit is contained in:
A Thousand Ships
2024-08-25 14:13:44 +02:00
parent c6c464cf9a
commit ec650a2f09
14 changed files with 39 additions and 39 deletions

View File

@@ -290,7 +290,7 @@ Ref<Resource> ResourceLoader::_load(const String &p_path, const String &p_origin
}
found = true;
res = loader[i]->load(p_path, original_path, r_error, p_use_sub_threads, r_progress, p_cache_mode);
if (!res.is_null()) {
if (res.is_valid()) {
break;
}
}
@@ -299,7 +299,7 @@ Ref<Resource> ResourceLoader::_load(const String &p_path, const String &p_origin
res_ref_overrides.erase(load_nesting);
load_nesting--;
if (!res.is_null()) {
if (res.is_valid()) {
return res;
}
@@ -514,7 +514,7 @@ Ref<Resource> ResourceLoader::load(const String &p_path, const String &p_type_hi
thread_mode = LOAD_THREAD_SPAWN_SINGLE;
}
Ref<LoadToken> load_token = _load_start(p_path, p_type_hint, thread_mode, p_cache_mode);
if (!load_token.is_valid()) {
if (load_token.is_null()) {
if (r_error) {
*r_error = FAILED;
}
@@ -934,7 +934,7 @@ Ref<Resource> ResourceLoader::ensure_resource_ref_override_for_outer_load(const
Object *obj = ClassDB::instantiate(p_res_type);
ERR_FAIL_NULL_V(obj, Ref<Resource>());
Ref<Resource> res(obj);
if (!res.is_valid()) {
if (res.is_null()) {
memdelete(obj);
ERR_FAIL_V(Ref<Resource>());
}