summaryrefslogtreecommitdiff
path: root/scene/gui/option_button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/option_button.cpp')
-rw-r--r--scene/gui/option_button.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index ff94a37be0..3cc5acc1a6 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -77,9 +77,14 @@ void OptionButton::_selected(int p_which) {
}
}
- ERR_FAIL_COND(selid==-1);
+ if (selid==-1 && p_which>=0 && p_which<popup->get_item_count()) {
+ _select(p_which,true);
+ } else {
- _select(selid,true);
+ ERR_FAIL_COND(selid==-1);
+
+ _select(selid,true);
+ }
}