diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-20 21:12:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-20 21:12:57 +0200 |
commit | 8474bb0a3c4c231016a827e582f9bb54979911f1 (patch) | |
tree | 1b5d379a8f7eefccfdad7c72e255d060932e7ed9 /scene/gui | |
parent | af976e4834abcf3c5e252bfeab1583568d32272e (diff) | |
parent | 2203670cccda4e2037757223f86de554fc174eb7 (diff) |
Merge pull request #54023 from zedutch/fix-empty-tabs-crash
Fix Tabs crashing on click input if there are no tabs
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/tab_bar.cpp | 5 |
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)) { |