better error checking when writing downloaded file.

meow-7.2.2
Andrew A. de Laix 2010-11-16 09:43:23 -08:00
parent f47c42bb10
commit 64876ea945
1 changed files with 6 additions and 1 deletions

View File

@ -275,9 +275,14 @@ size_t LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size)
size_t LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size)
{
if(mCancelled) return 0; // Forces a write error which will halt curl thread.
if((size == 0) || (buffer == 0)) return 0;
mDownloadStream.write(reinterpret_cast<const char *>(buffer), size);
return size;
if(mDownloadStream.bad()) {
return 0;
} else {
return size;
}
}