From 2eef72e16542db43679e3200970d4f2f3deacd08 Mon Sep 17 00:00:00 2001 From: real-zony Date: Sun, 29 Jan 2023 22:55:20 +0800 Subject: [PATCH] fix: Avoid null reference exception. --- ZonyLrcTools.sln.DotSettings | 2 ++ src/ZonyLrcTools.Common/Updater/DefaultUpdater.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 ZonyLrcTools.sln.DotSettings diff --git a/ZonyLrcTools.sln.DotSettings b/ZonyLrcTools.sln.DotSettings new file mode 100644 index 0000000..43ff6d0 --- /dev/null +++ b/ZonyLrcTools.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/src/ZonyLrcTools.Common/Updater/DefaultUpdater.cs b/src/ZonyLrcTools.Common/Updater/DefaultUpdater.cs index 63f3132..af1ee7f 100644 --- a/src/ZonyLrcTools.Common/Updater/DefaultUpdater.cs +++ b/src/ZonyLrcTools.Common/Updater/DefaultUpdater.cs @@ -36,7 +36,7 @@ public class DefaultUpdater : IUpdater, ISingletonDependency } var importantItem = response.Items?.FirstOrDefault(x => x.ItemType == NewVersionItemType.Important); - if (importantItem != null) + if (importantItem?.Url != null) { _logger.LogWarning($"发现了新版本,请点击下面的链接进行更新:{importantItem.Url}"); _logger.LogWarning($"最新版本号:{response.NewVersion},当前版本号: ${currentVersion}");