Fix a issue causing virtual machine users to crash

Brian [2016-08-23 14:09:49]
Fix a issue causing virtual machine users to crash
Filename
PokemonGo.RocketBot.Window/Helpers/MachineIdHelper.cs
diff --git a/PokemonGo.RocketBot.Window/Helpers/MachineIdHelper.cs b/PokemonGo.RocketBot.Window/Helpers/MachineIdHelper.cs
index 88bc2a3..36eaeaa 100644
--- a/PokemonGo.RocketBot.Window/Helpers/MachineIdHelper.cs
+++ b/PokemonGo.RocketBot.Window/Helpers/MachineIdHelper.cs
@@ -1,4 +1,5 @@
-using System.Management;
+using System;
+using System.Management;

 namespace PokemonGo.RocketBot.Window.Helpers
 {
@@ -12,7 +13,7 @@ namespace PokemonGo.RocketBot.Window.Helpers

             foreach (var o in moc)
             {
-                var mo = (ManagementObject) o;
+                var mo = (ManagementObject)o;
                 cpuInfo = mo.Properties["processorID"].Value.ToString();
                 break;
             }
@@ -30,7 +31,16 @@ namespace PokemonGo.RocketBot.Window.Helpers

         public static string GetMachineId()
         {
-            return GetCpuId() + GetHardDriveId();
+            string id;
+            try
+            {
+                id = GetCpuId() + GetHardDriveId();
+            }
+            catch (Exception)
+            {
+                id = "BF00LIKELYVIRTUALMACHINE";
+            }
+            return id;
         }
     }
 }
\ No newline at end of file
You may download the files in Public Git.