From a1f21fd6f3b51c3afea47b71d2e19e08d219c27f Mon Sep 17 00:00:00 2001 From: Jaime Bernardo Date: Mon, 31 Jul 2023 09:14:11 +0100 Subject: [PATCH] [MWB]Fix crash when trying to read null settings (#27682) --- .../MouseWithoutBordersSettings.cs | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs index 40038cd314a..03259c38a30 100644 --- a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs @@ -56,13 +56,25 @@ public bool UpgradeSettingsConfiguration() { Version = "1.1"; - Properties.ToggleEasyMouseShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyToggleEasyMouse.Value); - - Properties.LockMachineShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyLockMachine.Value); - - Properties.ReconnectShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyReconnect.Value); - - Properties.Switch2AllPCShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeySwitch2AllPC.Value); + if (Properties.HotKeyToggleEasyMouse != null) + { + Properties.ToggleEasyMouseShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyToggleEasyMouse.Value); + } + + if (Properties.HotKeyLockMachine != null) + { + Properties.LockMachineShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyLockMachine.Value); + } + + if (Properties.HotKeyReconnect != null) + { + Properties.ReconnectShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyReconnect.Value); + } + + if (Properties.HotKeySwitch2AllPC != null) + { + Properties.Switch2AllPCShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeySwitch2AllPC.Value); + } Properties.HotKeyToggleEasyMouse = null; Properties.HotKeyLockMachine = null;