summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhairul169 <me@khairul.my.id>2018-07-01 15:26:29 +0700
committerkhairul169 <me@khairul.my.id>2018-07-01 15:38:42 +0700
commit0a67aa5ce4b0aba3553824a1ce9612aacadc600f (patch)
tree8638de8b0ed8c15457450553d2c310010622868d
parent3852c5f8a0b439a8c0c6e72433d6fe82e3e596de (diff)
Fix error msg when selecting popupmenu if there is no animation
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 3477a6ec30..93fa8613c1 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1102,9 +1102,12 @@ void AnimationPlayerEditor::_animation_about_to_show_menu() {
void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
- String current = animation->get_item_text(animation->get_selected());
+ String current;
+ if (animation->get_selected() >= 0 && animation->get_selected() < animation->get_item_count())
+ current = animation->get_item_text(animation->get_selected());
+
Ref<Animation> anim;
- if (current != "") {
+ if (current != String()) {
anim = player->get_animation(current);
}