SEBWIN-446: Ensured missing machine info doesn't result in fatal error during startup.
This commit is contained in:
parent
b8393f2ae5
commit
d2407afebf
1 changed files with 28 additions and 20 deletions
|
@ -53,6 +53,8 @@ namespace SafeExamBrowser.SystemComponents
|
|||
var model = default(string);
|
||||
var systemFamily = default(string);
|
||||
|
||||
try
|
||||
{
|
||||
using (var searcher = new ManagementObjectSearcher("Select * from Win32_ComputerSystem"))
|
||||
using (var results = searcher.Get())
|
||||
using (var system = results.Cast<ManagementObject>().First())
|
||||
|
@ -76,11 +78,17 @@ namespace SafeExamBrowser.SystemComponents
|
|||
systemFamily = Convert.ToString(property.Value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Model = string.Join(" ", systemFamily, model);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Manufacturer = "";
|
||||
Model = "";
|
||||
Name = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeOperatingSystem()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue