From 0d4923a65b7636d139966cf437edaaf4450a73a9 Mon Sep 17 00:00:00 2001 From: matty <10895809+murrty@users.noreply.github.com> Date: Tue, 22 Nov 2022 22:40:31 -0600 Subject: [PATCH] check if the registry key is not null closes #160 --- youtube-dl-gui/Classes/SystemRegistry.cs | 6 ++++-- youtube-dl-gui/Program.cs | 1 + youtube-dl-gui/Updater/API Data/GithubData.cs | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/youtube-dl-gui/Classes/SystemRegistry.cs b/youtube-dl-gui/Classes/SystemRegistry.cs index 0b7d596b..9f418500 100644 --- a/youtube-dl-gui/Classes/SystemRegistry.cs +++ b/youtube-dl-gui/Classes/SystemRegistry.cs @@ -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; } diff --git a/youtube-dl-gui/Program.cs b/youtube-dl-gui/Program.cs index e0551045..03a7a01e 100644 --- a/youtube-dl-gui/Program.cs +++ b/youtube-dl-gui/Program.cs @@ -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() { diff --git a/youtube-dl-gui/Updater/API Data/GithubData.cs b/youtube-dl-gui/Updater/API Data/GithubData.cs index 5cb86f58..17ec8314 100644 --- a/youtube-dl-gui/Updater/API Data/GithubData.cs +++ b/youtube-dl-gui/Updater/API Data/GithubData.cs @@ -96,15 +96,15 @@ internal Version GetVersion() => /// 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; }