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; }