Fixed crash if speed is reported as 0.

This commit is contained in:
IceStormNG
2023-07-24 16:20:16 +02:00
parent e0a517f42f
commit 5c065a3857

View File

@@ -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;
}