You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-27 15:57:02 +00:00
[Core,Drivers] Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
This commit is contained in:
@@ -235,7 +235,7 @@ void Resource::reload_from_file() {
|
||||
|
||||
Ref<Resource> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
|
||||
|
||||
if (!s.is_valid()) {
|
||||
if (s.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -655,7 +655,7 @@ Ref<Resource> ResourceCache::get_ref(const String &p_path) {
|
||||
ref = Ref<Resource>(*res);
|
||||
}
|
||||
|
||||
if (res && !ref.is_valid()) {
|
||||
if (res && ref.is_null()) {
|
||||
// This resource is in the process of being deleted, ignore its existence
|
||||
(*res)->path_cache = String();
|
||||
resources.erase(p_path);
|
||||
@@ -674,7 +674,7 @@ void ResourceCache::get_cached_resources(List<Ref<Resource>> *p_resources) {
|
||||
for (KeyValue<String, Resource *> &E : resources) {
|
||||
Ref<Resource> ref = Ref<Resource>(E.value);
|
||||
|
||||
if (!ref.is_valid()) {
|
||||
if (ref.is_null()) {
|
||||
// This resource is in the process of being deleted, ignore its existence
|
||||
E.value->path_cache = String();
|
||||
to_remove.push_back(E.key);
|
||||
|
||||
Reference in New Issue
Block a user