summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Arys <robin@blueoniongames.com>2021-10-20 14:37:43 +0200
committerRobin Arys <robin@blueoniongames.com>2021-10-20 18:26:10 +0200
commit2203670cccda4e2037757223f86de554fc174eb7 (patch)
treebfa82a7ac1953629105ff0446c0c1601b26f74ee
parent8748247d6f5b65358ae69f5c44f4fdfb70633382 (diff)
Fix Tabs crash where it still tries to detect the clicked tab even if there are none
-rw-r--r--scene/gui/tab_bar.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp
index 7c7e3b0547..78b58c773a 100644
--- a/scene/gui/tab_bar.cpp
+++ b/scene/gui/tab_bar.cpp
@@ -222,6 +222,11 @@ void TabBar::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)) {