Fix Mega downloader

This commit is contained in:
Timothy Baldridge 2022-02-27 14:38:23 -07:00
parent 0c75490055
commit b95007f81a

View File

@ -297,11 +297,12 @@ namespace Wabbajack
public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem, public void OnDownloadUpdated(IWebBrowser chromiumWebBrowser, IBrowser browser, DownloadItem downloadItem,
IDownloadItemCallback callback) IDownloadItemCallback callback)
{ {
if (_archive?.Size != 0 && downloadItem.TotalBytes != _archive?.Size) if (_archive?.Size != null && _archive?.Size != 0 && downloadItem.TotalBytes != _archive?.Size)
{ {
_tcs.SetCanceled(); _tcs.TrySetCanceled();
Utils.Error( Utils.Error(
$"Download of {_archive!.Name} (from {downloadItem.OriginalUrl}) aborted, selected file was {downloadItem.TotalBytes.ToFileSizeString()} expected size was {_archive!.Size.ToFileSizeString()}"); $"Download of {_archive!.Name} (from {downloadItem.OriginalUrl}) aborted, selected file was {downloadItem.TotalBytes.ToFileSizeString()} expected size was {_archive!.Size.ToFileSizeString()}");
callback.Cancel();
return; return;
} }