Skip to content

Commit

Permalink
Stop an NRE when checking the registry for startup tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmahDean committed Dec 17, 2023
1 parent 4e2055c commit f957e04
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions client/DebugLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public static void CheckOpenTasks()
var section = OpenTasks[i];
if(section.Count > 0)
{
LogEvent($"{region} has outstanding tasks", region, EventType.ERROR);
LogEvent($"{region} has outstanding tasks:", region, EventType.ERROR);
foreach(var task in section)
{
LogEvent(task.Key, region);
LogEvent($"OUTSTANDING: {task.Key}", region);
}
}
}
Expand Down
33 changes: 18 additions & 15 deletions client/data/Methods/System.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ public static async Task MakeSystemData()
Region region = Region.System;
await StartRegion(region);

systemTaskList.Add(GetEnvironmentVariables());
systemTaskList.Add(GetSystemWMIInfo());
systemTaskList.Add(CheckCommercialOneDrive());
systemTaskList.Add(GetInstalledApps());
systemTaskList.Add(GetScheduledTasks());
systemTaskList.Add(GetEnvironmentVariables());
systemTaskList.Add(GetSystemWMIInfo());
systemTaskList.Add(CheckCommercialOneDrive());
systemTaskList.Add(GetInstalledApps());
systemTaskList.Add(GetScheduledTasks());
systemTaskList.Add(GetStartupTasks());
systemTaskList.Add(RegistryCheck());
systemTaskList.Add(GetMicroCodes());
systemTaskList.Add(GetStaticCoreCount());
systemTaskList.Add(GetBrowserExtensions());
systemTaskList.Add(GetMiniDumps());
systemTaskList.Add(GetDefaultBrowser());
systemTaskList.Add(GetProcesses());
systemTaskList.Add(RegistryCheck());
systemTaskList.Add(GetMicroCodes());
systemTaskList.Add(GetStaticCoreCount());
systemTaskList.Add(GetBrowserExtensions());
systemTaskList.Add(GetMiniDumps());
systemTaskList.Add(GetDefaultBrowser());
systemTaskList.Add(GetProcesses());

// Check if username contains non-alphanumeric characters
UsernameSpecialCharacters = !Regex.IsMatch(Environment.UserName, @"^[a-zA-Z0-9]+$");
Expand Down Expand Up @@ -239,10 +239,13 @@ private static async Task<List<StartupTask>> GetStartupTasksAtKey(string keyLoca
{
List<StartupTask> startupTasks = new();
var key = reg.OpenSubKey(keyLocation);
foreach (var appName in key.GetValueNames())
if (key != null)
{
var startupTask = await CreateStartupTask(appName, (string)key.GetValue(appName));
startupTasks.Add(startupTask);
foreach (var appName in key.GetValueNames())
{
var startupTask = await CreateStartupTask(appName, (string)key.GetValue(appName));
startupTasks.Add(startupTask);
}
}
return startupTasks;
}
Expand Down

0 comments on commit f957e04

Please sign in to comment.