Fixed a issue where the Installer crashed when a invalid path is in registry.
This commit is contained in:
@@ -13,13 +13,19 @@ namespace EZPPClient_Installer
|
||||
|
||||
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
|
||||
{
|
||||
foreach (string subkey_name in key.GetSubKeyNames())
|
||||
if (key != null && key.GetSubKeyNames() != null)
|
||||
{
|
||||
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
||||
foreach (string subkey_name in key.GetSubKeyNames())
|
||||
{
|
||||
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
||||
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
||||
{
|
||||
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
||||
if (subkey != null)
|
||||
{
|
||||
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
||||
{
|
||||
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,13 +35,19 @@ namespace EZPPClient_Installer
|
||||
{
|
||||
using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(second_registry_key))
|
||||
{
|
||||
foreach (string subkey_name in key.GetSubKeyNames())
|
||||
if (key != null && key.GetSubKeyNames() != null)
|
||||
{
|
||||
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
||||
foreach (string subkey_name in key.GetSubKeyNames())
|
||||
{
|
||||
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
||||
using (RegistryKey subkey = key.OpenSubKey(subkey_name))
|
||||
{
|
||||
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
||||
if (subkey != null)
|
||||
{
|
||||
if ((string)subkey.GetValue("DisplayName") == "osu!")
|
||||
{
|
||||
path = Path.GetDirectoryName(subkey.GetValue("DisplayIcon").ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user