mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Better handling of malformed registry key (#264)
This commit is contained in:
parent
244c3dee40
commit
ada0dc91af
@ -174,7 +174,12 @@ namespace Bloxstrap
|
|||||||
// check if installed
|
// check if installed
|
||||||
using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}"))
|
using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}"))
|
||||||
{
|
{
|
||||||
if (registryKey is null)
|
string? installLocation = null;
|
||||||
|
|
||||||
|
if (registryKey is not null)
|
||||||
|
installLocation = (string?)registryKey.GetValue("InstallLocation");
|
||||||
|
|
||||||
|
if (registryKey is null || installLocation is null)
|
||||||
{
|
{
|
||||||
Logger.WriteLine("[App::OnStartup] Running first-time install");
|
Logger.WriteLine("[App::OnStartup] Running first-time install");
|
||||||
|
|
||||||
@ -191,7 +196,7 @@ namespace Bloxstrap
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
IsFirstRun = false;
|
IsFirstRun = false;
|
||||||
BaseDirectory = (string)registryKey.GetValue("InstallLocation")!;
|
BaseDirectory = installLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user