mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
UI/Qt: Ignore tab bar middle clicks if the user didn't click on a tab
This avoids a segfault that would previously occur when middle clicking to close a tab if only 1 tab was open. (cherry picked from commit b95c05b6115c8eb84fe6fec55f5152db852fe743)
This commit is contained in:
parent
d9245bc5ac
commit
d4f135b2c6
1 changed files with 4 additions and 2 deletions
|
@ -1008,8 +1008,10 @@ bool BrowserWindow::eventFilter(QObject* obj, QEvent* event)
|
|||
if (mouse_event->button() == Qt::MouseButton::MiddleButton) {
|
||||
if (obj == m_tabs_container) {
|
||||
auto const tab_index = m_tabs_container->tabBar()->tabAt(mouse_event->pos());
|
||||
close_tab(tab_index);
|
||||
return true;
|
||||
if (tab_index != -1) {
|
||||
close_tab(tab_index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue