From 5677df5101382aa5ccf1aab2630cd83f7635cb2a Mon Sep 17 00:00:00 2001 From: The_Masked_Man <46354545+TheMaskedMan00@users.noreply.github.com> Date: Sat, 30 Dec 2023 04:25:58 -0500 Subject: [PATCH] Update OpenHardwareMonitorHttp.cs (Fixes a Edge case where sensor value = NaN) (#2257) * Update OpenHardwareMonitorHttp.cs Fix error on sensor value NaN * Fix style issue --------- Co-authored-by: Patrick Grawehr --- src/devices/HardwareMonitor/OpenHardwareMonitorHttp.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/devices/HardwareMonitor/OpenHardwareMonitorHttp.cs b/src/devices/HardwareMonitor/OpenHardwareMonitorHttp.cs index 952cc752d2..1c72003102 100644 --- a/src/devices/HardwareMonitor/OpenHardwareMonitorHttp.cs +++ b/src/devices/HardwareMonitor/OpenHardwareMonitorHttp.cs @@ -96,6 +96,7 @@ private void GetFullDataAndDecode(bool refreshSensorList) try { string fullJson = _httpClient.GetStringAsync(_uri + "api/rootnode").Result; + fullJson = fullJson.Replace("\"Value\": NaN", "\"Value\": 0"); // this fixes an error I encounter where a sensors value is NaN causing the entire thing to crash. lock (_lock) { ComputerJson? rootNode = JsonSerializer.Deserialize(fullJson);