From 7b9958247a797396fb18816472e080150be6a3d6 Mon Sep 17 00:00:00 2001 From: Andrew Lanzone Date: Sun, 27 Jul 2025 14:08:13 -0700 Subject: [PATCH] Null ControllerButtons pointers are supported; they hide the button overlay --- .../openmw/mwgui/controllerbuttonsoverlay.cpp | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/apps/openmw/mwgui/controllerbuttonsoverlay.cpp b/apps/openmw/mwgui/controllerbuttonsoverlay.cpp index fc4cdfaec2..725ea8a0a1 100644 --- a/apps/openmw/mwgui/controllerbuttonsoverlay.cpp +++ b/apps/openmw/mwgui/controllerbuttonsoverlay.cpp @@ -49,23 +49,26 @@ namespace MWGui void ControllerButtonsOverlay::setButtons(ControllerButtons* buttons) { int buttonCount = 0; - buttonCount += updateButton(Button::Button_A, buttons->mA); - buttonCount += updateButton(Button::Button_B, buttons->mB); - buttonCount += updateButton(Button::Button_Dpad, buttons->mDpad); - buttonCount += updateButton(Button::Button_L1, buttons->mL1); - buttonCount += updateButton(Button::Button_L2, buttons->mL2); - buttonCount += updateButton(Button::Button_L3, buttons->mL3); - buttonCount += updateButton(Button::Button_LStick, buttons->mLStick); - buttonCount += updateButton(Button::Button_Menu, buttons->mMenu); - buttonCount += updateButton(Button::Button_R1, buttons->mR1); - buttonCount += updateButton(Button::Button_R2, buttons->mR2); - buttonCount += updateButton(Button::Button_R3, buttons->mR3); - buttonCount += updateButton(Button::Button_RStick, buttons->mRStick); - buttonCount += updateButton(Button::Button_View, buttons->mView); - buttonCount += updateButton(Button::Button_X, buttons->mX); - buttonCount += updateButton(Button::Button_Y, buttons->mY); + if (buttons != nullptr) + { + buttonCount += updateButton(Button::Button_A, buttons->mA); + buttonCount += updateButton(Button::Button_B, buttons->mB); + buttonCount += updateButton(Button::Button_Dpad, buttons->mDpad); + buttonCount += updateButton(Button::Button_L1, buttons->mL1); + buttonCount += updateButton(Button::Button_L2, buttons->mL2); + buttonCount += updateButton(Button::Button_L3, buttons->mL3); + buttonCount += updateButton(Button::Button_LStick, buttons->mLStick); + buttonCount += updateButton(Button::Button_Menu, buttons->mMenu); + buttonCount += updateButton(Button::Button_R1, buttons->mR1); + buttonCount += updateButton(Button::Button_R2, buttons->mR2); + buttonCount += updateButton(Button::Button_R3, buttons->mR3); + buttonCount += updateButton(Button::Button_RStick, buttons->mRStick); + buttonCount += updateButton(Button::Button_View, buttons->mView); + buttonCount += updateButton(Button::Button_X, buttons->mX); + buttonCount += updateButton(Button::Button_Y, buttons->mY); - mHBox->notifyChildrenSizeChanged(); + mHBox->notifyChildrenSizeChanged(); + } setVisible(buttonCount > 0); }