From c663cbbc45fbdeb48e81c12ab32b3642cb1e2b6a Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 6 Oct 2013 14:01:10 +0000 Subject: WinGui: Add some sanity checks around the Gpu Info checker. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5823 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Utilities/SystemInfo.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'win/CS/HandBrake.ApplicationServices') diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs index af4a57bcd..2ea664f1a 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs @@ -129,21 +129,26 @@ namespace HandBrake.ApplicationServices.Utilities List gpuInfo = new List(); ManagementObjectSearcher searcher = new ManagementObjectSearcher( "select * from " + "Win32_VideoController"); + foreach (ManagementObject share in searcher.Get()) { string gpu = string.Empty, version = string.Empty; foreach (PropertyData PC in share.Properties) { - if (PC.Name.Equals("DriverVersion")) version = PC.Value.ToString(); - - - if (PC.Name.Equals("Name")) - gpu = PC.Value.ToString(); + if (!string.IsNullOrEmpty(PC.Name) && PC.Value != null) + { + if (PC.Name.Equals("DriverVersion")) version = PC.Value.ToString(); + if (PC.Name.Equals("Name")) gpu = PC.Value.ToString(); + } } - gpuInfo.Add(string.Format("{0} - {1}", gpu, version)); + if (!string.IsNullOrEmpty(gpu) && !string.IsNullOrEmpty(version)) + { + gpuInfo.Add(string.Format("{0} - {1}", gpu, version)); + } } + return gpuInfo; } } -- cgit v1.2.3