From 1e17c932970f1b65f4275c241fbcaffaf331290f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Wed, 27 Jan 2010 18:12:51 +0000 Subject: [PATCH] Fixed a NullReferenceException in the HDD SMART code. --- GUI/MainForm.cs | 2 +- Hardware/HDD/HDDGroup.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/GUI/MainForm.cs b/GUI/MainForm.cs index 2f13744..7d238d8 100644 --- a/GUI/MainForm.cs +++ b/GUI/MainForm.cs @@ -126,7 +126,7 @@ namespace OpenHardwareMonitor.GUI { minMenuItem.Checked = Utilities.Config.Get(minMenuItem.Name, false); maxMenuItem.Checked = Utilities.Config.Get(maxMenuItem.Name, true); limitMenuItem.Checked = Utilities.Config.Get(limitMenuItem.Name, false); - hddMenuItem.Checked = Utilities.Config.Get(hddMenuItem.Name, false); + hddMenuItem.Checked = Utilities.Config.Get(hddMenuItem.Name, true); voltMenuItem.Checked = Utilities.Config.Get(voltMenuItem.Name, true); clocksMenuItem.Checked = Utilities.Config.Get(clocksMenuItem.Name, true); diff --git a/Hardware/HDD/HDDGroup.cs b/Hardware/HDD/HDDGroup.cs index 25d2ac6..132fad8 100644 --- a/Hardware/HDD/HDDGroup.cs +++ b/Hardware/HDD/HDDGroup.cs @@ -60,9 +60,12 @@ namespace OpenHardwareMonitor.Hardware.HDD { string name = SMART.ReadName(handle, drive); if (name != null) { - SMART.DriveAttribute[] attributes = + SMART.DriveAttribute[] attributes = SMART.ReadSmart(handle, drive); + if (attributes == null) + continue; + int attribute = -1; for (int i = 0; i < attributes.Length; i++) { if (attributes[i].ID == SMART.AttributeID.Temperature) {