diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-10-30 12:27:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 12:27:41 +0100 |
commit | debb67918e8644b975a929c0bdeff7922364f314 (patch) | |
tree | 51d07d30f483f0e66383faf8418c51820c76aef3 /scene | |
parent | f6f38ac08621753e9f0f5cc5f75164abacdfb817 (diff) | |
parent | 8a588343db2a061abcb5f28c0b94828f2de7ce90 (diff) |
Merge pull request #43173 from volzhs/fix-tab-container
Fix crash in TabContainer in case of no content at all
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/tab_container.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 4074c75dd7..bd9c2da5bc 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -371,8 +371,10 @@ void TabContainer::_notification(int p_what) { // Draw the tab area. panel->draw(canvas, Rect2(0, header_height, size.width, size.height - header_height)); - // Draw selected tab in front - _draw_tab(tab_fg, font_color_fg, current, tabs_ofs_cache + x_current); + // Draw selected tab in front. Need to check tabs.size() in case of no contents at all. + if (tabs.size() > 0) { + _draw_tab(tab_fg, font_color_fg, current, tabs_ofs_cache + x_current); + } // Draw the popup menu. x = get_size().width; |