Forráskód Böngészése

Fix Tabs crash where it still tries to detect the clicked tab even if there are none

(cherry picked from commit 2203670cccda4e2037757223f86de554fc174eb7)
Robin Arys 4 éve
szülő
commit
0dcf1e3a45
1 módosított fájl, 5 hozzáadás és 0 törlés
  1. 5 0
      scene/gui/tabs.cpp

+ 5 - 0
scene/gui/tabs.cpp

@@ -182,6 +182,11 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
 				}
 			}
 
+			if (max_drawn_tab <= 0) {
+				// Return early if there are no actual tabs to handle input for.
+				return;
+			}
+
 			int found = -1;
 			for (int i = offset; i <= max_drawn_tab; i++) {
 				if (tabs[i].rb_rect.has_point(pos)) {