File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -547,13 +547,18 @@ void AnimationPlayerEditor::_animation_name_edited() {
547547 } break ;
548548
549549 case TOOL_NEW_ANIM: {
550- String current = animation->get_item_text (animation->get_selected ());
551- Ref<Animation> current_anim = player->get_animation (current);
552550 Ref<Animation> new_anim = Ref<Animation>(memnew (Animation));
553551 new_anim->set_name (new_name);
554- if (current_anim.is_valid ()) {
555- new_anim->set_step (current_anim->get_step ());
552+
553+ if (animation->get_item_count () > 0 ) {
554+ String current = animation->get_item_text (animation->get_selected ());
555+ Ref<Animation> current_anim = player->get_animation (current);
556+
557+ if (current_anim.is_valid ()) {
558+ new_anim->set_step (current_anim->get_step ());
559+ }
556560 }
561+
557562 String library_name;
558563 Ref<AnimationLibrary> al;
559564 library_name = library->get_item_metadata (library->get_selected ());
You can’t perform that action at this time.
0 commit comments