Gui: [skip ci] fix possible crash in FilterStatusBar::eventFilter()

This commit is contained in:
wmayer
2022-11-05 13:33:18 +01:00
parent df9c800d38
commit 8fcc6fd9cf

View File

@@ -376,7 +376,8 @@ protected:
Action * action;
bool eventFilter(QObject *obj, QEvent *event) override
{
if (getMainWindow()->findChild<QStatusBar *>() && obj == getMainWindow()->statusBar() && ((event->type() == QEvent::Hide) || (event->type() == QEvent::Show))) {
if (getMainWindow() && getMainWindow()->findChild<QStatusBar *>() && obj == getMainWindow()->statusBar() &&
((event->type() == QEvent::Hide) || (event->type() == QEvent::Show))) {
this->action->setChecked(getMainWindow()->statusBar()->isVisible());
}
return false;