Cleanup of raw nullptr checks with Ref

Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
This commit is contained in:
A Thousand Ships
2024-07-26 11:52:26 +02:00
parent 61598c5c88
commit 194bdde947
48 changed files with 169 additions and 170 deletions

View File

@@ -463,7 +463,7 @@ void AnimatedSprite2D::play(const StringName &p_name, float p_custom_scale, bool
name = animation;
}
ERR_FAIL_NULL_MSG(frames, vformat("There is no animation with name '%s'.", name));
ERR_FAIL_COND_MSG(frames.is_null(), vformat("There is no animation with name '%s'.", name));
ERR_FAIL_COND_MSG(!frames->get_animation_names().has(name), vformat("There is no animation with name '%s'.", name));
if (frames->get_frame_count(name) == 0) {
@@ -541,7 +541,7 @@ void AnimatedSprite2D::set_animation(const StringName &p_name) {
emit_signal(SceneStringName(animation_changed));
if (frames == nullptr) {
if (frames.is_null()) {
animation = StringName();
stop();
ERR_FAIL_MSG(vformat("There is no animation with name '%s'.", p_name));