From 5c065a385713d19aa325e3e3ce9061b70e705dfe Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Mon, 24 Jul 2023 16:20:16 +0200 Subject: [PATCH] Fixed crash if speed is reported as 0. --- app/Peripherals/Mouse/AsusMouse.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Peripherals/Mouse/AsusMouse.cs b/app/Peripherals/Mouse/AsusMouse.cs index 1752cc2c..b2f54c4a 100644 --- a/app/Peripherals/Mouse/AsusMouse.cs +++ b/app/Peripherals/Mouse/AsusMouse.cs @@ -956,6 +956,13 @@ namespace GHelper.Peripherals.Mouse setting.RandomColor = packet[12] == 0x01; setting.AnimationSpeed = (AnimationSpeed)packet[13]; + //If the mouse reports 0, which it does when the current setting has no speed option, chose medium as default + if (setting.AnimationSpeed != AnimationSpeed.Fast + && setting.AnimationSpeed != AnimationSpeed.Medium + && setting.AnimationSpeed != AnimationSpeed.Slow) + { + setting.AnimationSpeed = AnimationSpeed.Medium; + } return setting; }