Add missing clamp around pump speed index (#320)

This commit is contained in:
Tim Sirmovics
2020-10-26 13:08:12 +01:00
committed by GitHub
parent ff24588236
commit db339d5623
@@ -150,7 +150,8 @@ namespace LibreHardwareMonitor.Hardware.Controller.Nzxt
}
else if (_pump.Value != _rawData[19])
{
byte pumpSpeedIndex = (byte)_pump.Value;
float value = _pump.Value.GetValueOrDefault();
byte pumpSpeedIndex = (byte)(value > 100 ? 100 : (value < 0) ? 0 : value); // Clamp the value, anything out of range will fail
_stream.Write(_setPumpTargetMap[pumpSpeedIndex]);
}
else