Skip to content

Commit

Permalink
Update OpenHardwareMonitorHttp.cs (Fixes a Edge case where sensor val…
Browse files Browse the repository at this point in the history
…ue = NaN) (#2257)

* Update OpenHardwareMonitorHttp.cs

Fix error on sensor value NaN

* Fix style issue

---------

Co-authored-by: Patrick Grawehr <[email protected]>
  • Loading branch information
TheMaskedMan00 and pgrawehr authored Dec 30, 2023
1 parent ff52320 commit 5677df5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/devices/HardwareMonitor/OpenHardwareMonitorHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComputerJson>(fullJson);
Expand Down

0 comments on commit 5677df5

Please sign in to comment.