mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-22 09:57:20 +00:00
Fixed a NullReferenceException in the NvidiaGPU class.
This commit is contained in:
parent
77908f1d99
commit
6dc0e141c3
@ -96,7 +96,8 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
if (NVML.IsInitialized) {
|
if (NVML.IsInitialized) {
|
||||||
if (NVAPI.NvAPI_GPU_GetBusId != null &&
|
if (NVAPI.NvAPI_GPU_GetBusId != null &&
|
||||||
NVAPI.NvAPI_GPU_GetBusId(handle, out uint busId) == NvStatus.OK) {
|
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)
|
"0000:" + busId.ToString("X2") + ":00.0", out var result)
|
||||||
== NVML.NvmlReturn.Success)
|
== NVML.NvmlReturn.Success)
|
||||||
{
|
{
|
||||||
@ -185,8 +186,8 @@ namespace OpenHardwareMonitor.Hardware.Nvidia {
|
|||||||
sensor.Value = settings.Sensor[sensor.Index].CurrentTemp;
|
sensor.Value = settings.Sensor[sensor.Index].CurrentTemp;
|
||||||
|
|
||||||
bool tachReadingOk = false;
|
bool tachReadingOk = false;
|
||||||
if (fan != null && NVAPI.NvAPI_GPU_GetTachReading(handle, out int fanValue)
|
if (NVAPI.NvAPI_GPU_GetTachReading != null &&
|
||||||
== NvStatus.OK)
|
NVAPI.NvAPI_GPU_GetTachReading(handle, out int fanValue) == NvStatus.OK)
|
||||||
{
|
{
|
||||||
fan.Value = fanValue;
|
fan.Value = fanValue;
|
||||||
ActivateSensor(fan);
|
ActivateSensor(fan);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user