Browse Source

Merge pull request #106254 from chsoen/fix-105582

Change Selected value for OptionButton when last item is deleted.
Thaddeus Crews 3 months ago
parent
commit
5186987dde
1 changed files with 4 additions and 0 deletions
  1. 4 0
      scene/gui/option_button.cpp

+ 4 - 0
scene/gui/option_button.cpp

@@ -314,6 +314,10 @@ void OptionButton::set_item_count(int p_count) {
 		return;
 	}
 
+	if (current > p_count - 1) {
+		_select(p_count - 1, false);
+	}
+
 	popup->set_item_count(p_count);
 
 	if (p_count > count_old) {