Skip to content

Commit

Permalink
check if the registry key is not null
Browse files Browse the repository at this point in the history
closes #160
  • Loading branch information
murrty committed Nov 23, 2022
1 parent dd61fa8 commit 0d4923a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions youtube-dl-gui/Classes/SystemRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ public static bool CheckRegistry() {
ProtocolKey.GetValue("URL Protocol") is not null &&
ProtocolKey.OpenSubKey("shell\\open\\command").GetValue("").ToString().ToLowerInvariant() == $"\"{Program.FullProgramPath}\" \"%1\"".ToLowerInvariant();

ProtocolKey.Close();
ProtocolKey.Dispose();
if (ProtocolKey is not null) {
ProtocolKey.Close();
ProtocolKey.Dispose();
}

return Available;
}
Expand Down
1 change: 1 addition & 0 deletions youtube-dl-gui/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ internal static void KillForUpdate() {
// Any downloads/conversion/merges in progress will finish before fully closing for updates.
MainForm?.RemoveTrayIcon();
MainForm?.Dispose();
Messages?.Dispose();
}

internal static void SetTls() {
Expand Down
6 changes: 3 additions & 3 deletions youtube-dl-gui/Updater/API Data/GithubData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ internal Version GetVersion() =>
/// <returns></returns>
private string FindHash() {
if (!VersionDescription.IsNullEmptyWhitespace()) {
MatchCollection Matches = Regex.Matches(VersionDescription, "(?<=exe sha-256: )[0-9a-fA-F]{64}(?=)");
MatchCollection Matches = Regex.Matches(VersionDescription, "(?<=exe sha-256: )(`)?[0-9a-fA-F]{64}(`)?(?=)");
if (Matches.Count > 0) {
return Matches[0].Value;
}
Matches = Regex.Matches(VersionDescription, "(?<=exe sha256: )[0-9a-fA-F]{64}(?=)");
Matches = Regex.Matches(VersionDescription, "(?<=exe sha256: )(`)?[0-9a-fA-F]{64}(`)?(?=)");
if (Matches.Count > 0) {
return Matches[0].Value;
}
Matches = Regex.Matches(VersionDescription, "(?<=exe sha 256: )[0-9a-fA-F]{64}(?=)");
Matches = Regex.Matches(VersionDescription, "(?<=exe sha 256: )(`)?[0-9a-fA-F]{64}(`)?(?=)");
if (Matches.Count > 0) {
return Matches[0].Value;
}
Expand Down

0 comments on commit 0d4923a

Please sign in to comment.