From bc45d10344404e80ad20e7bf23af3a7442a32c41 Mon Sep 17 00:00:00 2001 From: TTLC198 Date: Mon, 4 Dec 2023 19:50:02 +0300 Subject: [PATCH] Fixed display of GPU fans --- HSMonitor/ViewModels/DashboardViewModel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/HSMonitor/ViewModels/DashboardViewModel.cs b/HSMonitor/ViewModels/DashboardViewModel.cs index 8bee77f..80b237e 100644 --- a/HSMonitor/ViewModels/DashboardViewModel.cs +++ b/HSMonitor/ViewModels/DashboardViewModel.cs @@ -91,10 +91,10 @@ private set public GpuFan GpuFan1 { - get => _gpu is {GpuFans: null} ? new GpuFan() : _gpu.GpuFans.ToArray()[0]; + get => _gpu is {GpuFans: null} ? new GpuFan() : _gpu.GpuFans.ToArray().ElementAtOrDefault(0) ?? new GpuFan(); set { - if (_gpu is {GpuFans: null}) return; + if (_gpu is {GpuFans: null} || _gpu.GpuFans.ToArray().ElementAtOrDefault(0) is null) return; _gpu.GpuFans.ToArray()[0] = value; OnPropertyChanged(); } @@ -102,10 +102,10 @@ public GpuFan GpuFan1 public GpuFan GpuFan2 { - get => _gpu is {GpuFans: null} ? new GpuFan() : _gpu.GpuFans.ToArray()[1]; + get => _gpu is {GpuFans: null} ? new GpuFan() : _gpu.GpuFans.ToArray().ElementAtOrDefault(1) ?? new GpuFan(); set { - if (_gpu is {GpuFans: null}) return; + if (_gpu is {GpuFans: null} || _gpu.GpuFans.ToArray().ElementAtOrDefault(1) is null) return; _gpu.GpuFans.ToArray()[1] = value; OnPropertyChanged(); }