1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibGUI+Browser: Fix crash when activating a "Tab n" action

Previously we would try setting the tab index regardless if that tab
actually existed, resulting in Browser crashing by either pressing
Control + N or using the CommandPalette.
This commit is contained in:
networkException 2022-06-05 13:08:09 +02:00 committed by Linus Groh
parent 971d6ce16f
commit 52ee5026ea
2 changed files with 4 additions and 1 deletions

View file

@ -111,8 +111,10 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
m_tab_widget->activate_previous_tab();
};
for (int i = 0; i <= 7; ++i) {
for (size_t i = 0; i <= 7; ++i) {
m_window_actions.on_tabs.append([this, i] {
if (i >= m_tab_widget->tab_count())
return;
m_tab_widget->set_tab_index(i);
});
}