mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
checks matches of regex search before accessing it
This commit is contained in:
parent
65ccc6876a
commit
0b8117d39b
@ -588,13 +588,20 @@ namespace DisplayMagician.GameLibraries
|
|||||||
{
|
{
|
||||||
// Lookup the GameId within the registry key
|
// Lookup the GameId within the registry key
|
||||||
mc = Regex.Matches(uplayEntryLines[i], @"Installs\\(\d+)\\InstallDir");
|
mc = Regex.Matches(uplayEntryLines[i], @"Installs\\(\d+)\\InstallDir");
|
||||||
gameId = mc[0].Groups[1].ToString();
|
if (mc.Count > 0)
|
||||||
gotGameId = true;
|
{
|
||||||
mc = Regex.Matches(uplayEntryLines[i], @"HKEY_LOCAL_MACHINE\\(.*?)\\InstallDir");
|
gameId = mc[0].Groups[1].ToString();
|
||||||
gameRegistryKey = mc[0].Groups[1].ToString();
|
gotGameId = true;
|
||||||
gameRegistryKey = gameRegistryKey.Replace(@"Ubisoft", @"WOW6432Node\Ubisoft");
|
mc = Regex.Matches(uplayEntryLines[i], @"HKEY_LOCAL_MACHINE\\(.*?)\\InstallDir");
|
||||||
gotGameRegistryKey = true;
|
gameRegistryKey = mc[0].Groups[1].ToString();
|
||||||
logger.Trace($"UplayLibrary/LoadInstalledGames: Found gameId = {gameId} and gameRegistryKey = {gameRegistryKey}");
|
gameRegistryKey = gameRegistryKey.Replace(@"Ubisoft", @"WOW6432Node\Ubisoft");
|
||||||
|
gotGameRegistryKey = true;
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Found gameId = {gameId} and gameRegistryKey = {gameRegistryKey}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Trace($"UplayLibrary/LoadInstalledGames: Game with uplayEntryLines[{i}]: '{uplayEntryLines[i]}' not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user