summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2018-07-03 18:44:48 +0200
committerGitHub <noreply@github.com>2018-07-03 18:44:48 +0200
commit27b20e767083781282b9db7ba50d7b2bdf2fb378 (patch)
treefe1e3d6707ba78108bb597ac61951f90682eac1f /editor
parent2017119a3dfda0ac6b1aa30c949a7e9b8e5f1e77 (diff)
parent0a67aa5ce4b0aba3553824a1ce9612aacadc600f (diff)
Merge pull request #19881 from khairul169/popupmenu_animedit
Fix error msg when selecting popupmenu if there is no animation selected
Diffstat (limited to 'editor')
-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 248e386bf1..b38ff239cc 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1103,9 +1103,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);
}