mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Merge pull request #96076 from AThousandShips/improve_null_check_core_drivers
[Core,Drivers] Improve use of `Ref.is_null/valid`
This commit is contained in:
@@ -231,7 +231,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;
|
||||
}
|
||||
|
||||
@@ -651,7 +651,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);
|
||||
@@ -670,7 +670,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