You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Improve use of Ref.is_null/valid
Use `is_null` over `!is_valid` and vice versa.
This commit is contained in:
committed by
AThousandShips
parent
0f95e9f8e6
commit
a1846b27ea
@@ -194,7 +194,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
|
||||
if (i == 0 && base_scene_idx >= 0) {
|
||||
// Scene inheritance on root node.
|
||||
Ref<PackedScene> sdata = props[base_scene_idx];
|
||||
ERR_FAIL_COND_V(!sdata.is_valid(), nullptr);
|
||||
ERR_FAIL_COND_V(sdata.is_null(), nullptr);
|
||||
node = sdata->instantiate(p_edit_state == GEN_EDIT_STATE_DISABLED ? PackedScene::GEN_EDIT_STATE_DISABLED : PackedScene::GEN_EDIT_STATE_INSTANCE); //only main gets main edit state
|
||||
ERR_FAIL_NULL_V(node, nullptr);
|
||||
if (p_edit_state != GEN_EDIT_STATE_DISABLED) {
|
||||
@@ -767,7 +767,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has
|
||||
} else {
|
||||
//must instance ourselves
|
||||
Ref<PackedScene> instance = ResourceLoader::load(p_node->get_scene_file_path());
|
||||
if (!instance.is_valid()) {
|
||||
if (instance.is_null()) {
|
||||
return ERR_CANT_OPEN;
|
||||
}
|
||||
|
||||
@@ -2146,7 +2146,7 @@ void PackedScene::reload_from_file() {
|
||||
}
|
||||
|
||||
Ref<PackedScene> s = ResourceLoader::load(ResourceLoader::path_remap(path), get_class(), ResourceFormatLoader::CACHE_MODE_IGNORE);
|
||||
if (!s.is_valid()) {
|
||||
if (s.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user