diff --git a/Core/Utils/TwitterUtils.cs b/Core/Utils/TwitterUtils.cs index bab34052..77708024 100644 --- a/Core/Utils/TwitterUtils.cs +++ b/Core/Utils/TwitterUtils.cs @@ -83,8 +83,8 @@ void ViewImageInternal(string path){ } string file = Path.Combine(BrowserCache.CacheFolder, GetImageFileName(url) ?? Path.GetRandomFileName()); - - if (File.Exists(file)){ + + if (WindowsUtils.FileExistsAndNotEmpty(file)){ ViewImageInternal(file); } else{ diff --git a/Core/Utils/WindowsUtils.cs b/Core/Utils/WindowsUtils.cs index 80dd9213..5d20578b 100644 --- a/Core/Utils/WindowsUtils.cs +++ b/Core/Utils/WindowsUtils.cs @@ -66,6 +66,14 @@ public static bool CheckFolderWritePermission(string path){ } } + public static bool FileExistsAndNotEmpty(string path){ + try{ + return new FileInfo(path).Length > 0; + }catch{ + return false; + } + } + public static bool OpenAssociatedProgram(string file, string arguments = "", bool runElevated = false){ try{ using(Process.Start(new ProcessStartInfo{ diff --git a/Updates/UpdateInfo.cs b/Updates/UpdateInfo.cs index b98d7638..b9a02e20 100644 --- a/Updates/UpdateInfo.cs +++ b/Updates/UpdateInfo.cs @@ -26,7 +26,7 @@ public UpdateInfo(string versionTag, string releaseNotes, string downloadUrl, st } public void BeginSilentDownload(){ - if (File.Exists(InstallerPath)){ + if (WindowsUtils.FileExistsAndNotEmpty(InstallerPath)){ DownloadStatus = UpdateDownloadStatus.Done; return; }