diff --git a/2.x/trunk/plugins/Updater/updater.c b/2.x/trunk/plugins/Updater/updater.c index bd7ad9b16..3619c9969 100644 --- a/2.x/trunk/plugins/Updater/updater.c +++ b/2.x/trunk/plugins/Updater/updater.c @@ -400,7 +400,8 @@ static NTSTATUS DownloadUpdateThreadStart( while ((nReadFile = InternetReadFile(hRequest, buffer, BUFFER_LEN, &dwBytesRead))) { - if (dwBytesRead == 0) + // If we get zero bytes or the download thread was closed. + if (dwBytesRead == 0 || !DownloadThreadHandle) break; if (!nReadFile) @@ -442,7 +443,8 @@ static NTSTATUS DownloadUpdateThreadStart( while ((nReadFile = InternetReadFile(hRequest, buffer, BUFFER_LEN, &dwBytesRead))) { - if (dwBytesRead == 0) + // If we get zero bytes or the download thread was closed. + if (dwBytesRead == 0 || !DownloadThreadHandle) break; if (!nReadFile)