mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user