From 72c382aca610a1f52d390aed260f6b93f1d0f4c9 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 6 Jan 2024 14:23:08 +0100 Subject: [PATCH] Don't crash when clicking the logo video --- apps/openmw/mwgui/windowbase.cpp | 2 +- apps/openmw/mwgui/windowbase.hpp | 2 +- apps/openmw/mwinput/mousemanager.cpp | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/windowbase.cpp b/apps/openmw/mwgui/windowbase.cpp index 4c191eaeb8..a680e38cf8 100644 --- a/apps/openmw/mwgui/windowbase.cpp +++ b/apps/openmw/mwgui/windowbase.cpp @@ -58,7 +58,7 @@ void WindowBase::setVisible(bool visible) onClose(); } -bool WindowBase::isVisible() +bool WindowBase::isVisible() const { return mMainWidget->getVisible(); } diff --git a/apps/openmw/mwgui/windowbase.hpp b/apps/openmw/mwgui/windowbase.hpp index 88b46b0bd2..54fb269305 100644 --- a/apps/openmw/mwgui/windowbase.hpp +++ b/apps/openmw/mwgui/windowbase.hpp @@ -37,7 +37,7 @@ namespace MWGui /// Sets the visibility of the window void setVisible(bool visible) override; /// Returns the visibility state of the window - bool isVisible(); + bool isVisible() const; void center(); diff --git a/apps/openmw/mwinput/mousemanager.cpp b/apps/openmw/mwinput/mousemanager.cpp index c91dfaedac..55b50b91ae 100644 --- a/apps/openmw/mwinput/mousemanager.cpp +++ b/apps/openmw/mwinput/mousemanager.cpp @@ -158,8 +158,9 @@ namespace MWInput // Don't trigger any mouse bindings while in settings menu, otherwise rebinding controls becomes impossible // Also do not trigger bindings when input controls are disabled, e.g. during save loading - if (!MWBase::Environment::get().getWindowManager()->getSettingsWindow()->isVisible() - && !input->controlsDisabled()) + const MWGui::SettingsWindow* settingsWindow + = MWBase::Environment::get().getWindowManager()->getSettingsWindow(); + if ((!settingsWindow || !settingsWindow->isVisible()) && !input->controlsDisabled()) mBindingsManager->mousePressed(arg, id); }