Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
Fix crash due to missing reg key
Browse files Browse the repository at this point in the history
  • Loading branch information
spikespaz committed Jul 7, 2020
1 parent 79945e9 commit 95ec8d4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,16 @@ static struct DeflectorSettings {
static bool disableNag; /// Flag to disable the reditection to the nag message.

static this() {
Key deflectorKey = Registry.currentUser.getKey("SOFTWARE\\Clients\\SearchDeflector", REGSAM.KEY_READ);
bool anyFailed = false;
Key deflectorKey;

try
deflectorKey = Registry.currentUser.getKey("SOFTWARE\\Clients\\SearchDeflector", REGSAM.KEY_READ);
catch (RegistryException) {
debug writeln("Failed to load key 'SOFTWARE\\Clients\\SearchDeflector', creating.");
anyFailed = true;
deflectorKey = Registry.currentUser.createKey("SOFTWARE\\Clients\\SearchDeflector", REGSAM.KEY_READ);
}

try
engineURL = deflectorKey.getValue("EngineURL").value_SZ;
Expand Down

0 comments on commit 95ec8d4

Please sign in to comment.