From 6dc0e141c306930eaa4d3835a3d8aa7eecb982f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Thu, 27 Feb 2020 22:07:24 +0100 Subject: [PATCH] Fixed a NullReferenceException in the NvidiaGPU class. --- Hardware/Nvidia/NvidiaGPU.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Hardware/Nvidia/NvidiaGPU.cs b/Hardware/Nvidia/NvidiaGPU.cs index 57a4752..ea7cb1c 100644 --- a/Hardware/Nvidia/NvidiaGPU.cs +++ b/Hardware/Nvidia/NvidiaGPU.cs @@ -96,7 +96,8 @@ namespace OpenHardwareMonitor.Hardware.Nvidia { if (NVML.IsInitialized) { if (NVAPI.NvAPI_GPU_GetBusId != null && NVAPI.NvAPI_GPU_GetBusId(handle, out uint busId) == NvStatus.OK) { - if (NVML.NvmlDeviceGetHandleByPciBusId( + if (NVML.NvmlDeviceGetHandleByPciBusId != null && + NVML.NvmlDeviceGetHandleByPciBusId( "0000:" + busId.ToString("X2") + ":00.0", out var result) == NVML.NvmlReturn.Success) { @@ -185,8 +186,8 @@ namespace OpenHardwareMonitor.Hardware.Nvidia { sensor.Value = settings.Sensor[sensor.Index].CurrentTemp; bool tachReadingOk = false; - if (fan != null && NVAPI.NvAPI_GPU_GetTachReading(handle, out int fanValue) - == NvStatus.OK) + if (NVAPI.NvAPI_GPU_GetTachReading != null && + NVAPI.NvAPI_GPU_GetTachReading(handle, out int fanValue) == NvStatus.OK) { fan.Value = fanValue; ActivateSensor(fan);