Merge pull request #54023 from zedutch/fix-empty-tabs-crash

Fix Tabs crashing on click input if there are no tabs
This commit is contained in:
Rémi Verschelde 2021-10-20 21:12:57 +02:00 committed by GitHub
commit 8474bb0a3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)) {