From 76b00b61083c8a44edcfd2921e0d2dbf97a80d5b Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Sat, 18 Oct 2025 12:02:41 +0200 Subject: [PATCH] UI tab widget Adds bounds checks to `visible()` and `tab_name()` methods --- UI/ui_tab_widget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UI/ui_tab_widget.cpp b/UI/ui_tab_widget.cpp index 9d8450c..507c3a7 100644 --- a/UI/ui_tab_widget.cpp +++ b/UI/ui_tab_widget.cpp @@ -37,6 +37,10 @@ void UI_tab_widget::set_visible(size_t index, bool visible) } bool UI_tab_widget::visible(size_t index) const { + if (index >= m_tab_visible.size()) + { + return false; + } return m_tab_visible.at(index); } @@ -52,6 +56,10 @@ void UI_tab_widget::set_tab_name(size_t index, std::string name) } std::string UI_tab_widget::tab_name(size_t index) const { + if (index >= m_tab_names.size()) + { + return ""; + } return m_tab_names.at(index); }