Fixed the NullReference Exception
authorpaulwerelds
Mon, 18 Oct 2010 07:18:14 +0000
changeset 23599b6bab765f8
parent 234 99fad54de9f7
child 236 763675f19ff4
Fixed the NullReference Exception
WMI/Hardware.cs
     1.1 --- a/WMI/Hardware.cs	Mon Oct 18 07:15:31 2010 +0000
     1.2 +++ b/WMI/Hardware.cs	Mon Oct 18 07:18:14 2010 +0000
     1.3 @@ -54,7 +54,9 @@
     1.4        Name = hardware.Name;
     1.5        Identifier = hardware.Identifier.ToString();
     1.6        HardwareType = hardware.HardwareType.ToString();
     1.7 -      Parent = hardware.Parent.Identifier.ToString();
     1.8 +      Parent = (hardware.Parent != null)
     1.9 +        ? hardware.Parent.Identifier.ToString()
    1.10 +        : "";
    1.11      }
    1.12  
    1.13      public void Update() { }