Fixed a NullReferenceException in HDD.Update.
authormoel.mich
Sun, 25 Apr 2010 13:16:28 +0000
changeset 96364ca73ba463
parent 95 249d57f82cf8
child 97 1a2d7dad320e
Fixed a NullReferenceException in HDD.Update.
Hardware/HDD/HDD.cs
     1.1 --- a/Hardware/HDD/HDD.cs	Sun Apr 25 12:35:16 2010 +0000
     1.2 +++ b/Hardware/HDD/HDD.cs	Sun Apr 25 13:16:28 2010 +0000
     1.3 @@ -94,7 +94,8 @@
     1.4      public void Update() {
     1.5        if (count == 0) {
     1.6          SMART.DriveAttribute[] attributes = SMART.ReadSmart(handle, drive);
     1.7 -        temperature.Value = attributes[attribute].RawValue[0];
     1.8 +        if (attributes != null && attribute < attributes.Length) 
     1.9 +          temperature.Value = attributes[attribute].RawValue[0];
    1.10        } else {
    1.11          temperature.Value = temperature.Value;
    1.12        }