From 52e36b0fd7eed79fd20cfa694206fa2da14103c7 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Tue, 8 Mar 2022 23:21:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E4=B8=8B=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/Services/Download/AddToDownloadService.cs | 2 +- DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DownKyi/Services/Download/AddToDownloadService.cs b/DownKyi/Services/Download/AddToDownloadService.cs index 13a3d4c..f6d1273 100644 --- a/DownKyi/Services/Download/AddToDownloadService.cs +++ b/DownKyi/Services/Download/AddToDownloadService.cs @@ -185,7 +185,7 @@ namespace DownKyi.Services.Download // 下载设置dialog中如果点击取消或者关闭窗口, // 会返回空字符串, // 这时直接退出 - if (directory == string.Empty) { return null; } + if (directory == null || directory == string.Empty) { return null; } // 文件夹不存在则创建 if (!Directory.Exists(directory)) diff --git a/DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs b/DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs index 6603ec7..c62b6aa 100644 --- a/DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs +++ b/DownKyi/ViewModels/Dialogs/ViewDownloadSetterViewModel.cs @@ -56,7 +56,7 @@ namespace DownKyi.ViewModels.Dialogs { SetProperty(ref directory, value); - if (directory != string.Empty) + if (directory != null && directory != string.Empty) { DriveName = directory.Substring(0, 1).ToUpper(); DriveNameFreeSpace = Format.FormatFileSize(HardDisk.GetHardDiskFreeSpace(DriveName)); @@ -381,7 +381,7 @@ namespace DownKyi.ViewModels.Dialogs // 弹出选择下载目录的窗口 path = DialogUtils.SetDownloadDirectory(); - if (path == null || path == "") + if (path == null || path == string.Empty) { return null; }