Attempt to fix an exception:
authormoel.mich
Sat, 22 May 2010 12:12:50 +0000
changeset 124b68a6f3b82a3
parent 123 912a06e2bd53
child 125 b1278888d9a9
Attempt to fix an exception:

Version: 0.1.34.0

System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto.
in OpenHardwareMonitor.Hardware.CPU.IntelCPU..ctor(Int32 processorIndex, CPUID[][] cpuid)
in OpenHardwareMonitor.Hardware.CPU.CPUGroup..ctor()
in OpenHardwareMonitor.Hardware.Computer.Open()
in OpenHardwareMonitor.GUI.MainForm..ctor()
in OpenHardwareMonitor.Program.Main()
Hardware/CPU/CPUID.cs
     1.1 --- a/Hardware/CPU/CPUID.cs	Fri May 21 17:28:52 2010 +0000
     1.2 +++ b/Hardware/CPU/CPUID.cs	Sat May 22 12:12:50 2010 +0000
     1.3 @@ -51,16 +51,13 @@
     1.4  
     1.5      private int thread;
     1.6  
     1.7 -    private uint maxCpuid = 0;
     1.8 -    private uint maxCpuidExt = 0;
     1.9 +    private Vendor vendor = Vendor.Unknown;
    1.10  
    1.11 -    private Vendor vendor;
    1.12 +    private string cpuBrandString = "";
    1.13 +    private string name = "";
    1.14  
    1.15 -    private string cpuBrandString;
    1.16 -    private string name;
    1.17 -
    1.18 -    private uint[,] cpuidData;
    1.19 -    private uint[,] cpuidExtData;
    1.20 +    private uint[,] cpuidData = new uint[0, 0];
    1.21 +    private uint[,] cpuidExtData = new uint[0, 0];
    1.22  
    1.23      private uint family;
    1.24      private uint model;
    1.25 @@ -102,6 +99,9 @@
    1.26      public CPUID(int thread) {
    1.27        this.thread = thread;
    1.28  
    1.29 +      uint maxCpuid = 0;
    1.30 +      uint maxCpuidExt = 0;
    1.31 +
    1.32        uint eax, ebx, ecx, edx;
    1.33  
    1.34        if (thread >= 32)
    1.35 @@ -138,6 +138,8 @@
    1.36              maxCpuidExt = eax - CPUID_EXT;
    1.37            else
    1.38              return;
    1.39 +        } else {
    1.40 +          throw new ArgumentException();
    1.41          }
    1.42        } else {
    1.43          throw new ArgumentException();
    1.44 @@ -236,14 +238,6 @@
    1.45        get { return thread; }
    1.46      }
    1.47  
    1.48 -    public uint MaxCPUID {
    1.49 -      get { return maxCpuid; }
    1.50 -    }
    1.51 -
    1.52 -    public uint MaxCpuidExt {
    1.53 -      get { return maxCpuidExt; }
    1.54 -    }
    1.55 -
    1.56      public Vendor Vendor {
    1.57        get { return vendor; }
    1.58      }