summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew A. de Laix <alain@lindenlab.com>2010-11-16 09:43:23 -0800
committerAndrew A. de Laix <alain@lindenlab.com>2010-11-16 09:43:23 -0800
commit64876ea9459ed0e0f1673c5ec9ae67abea2280e2 (patch)
tree9b1b853fef8ddff734be2bab88e46345eba6dc4a
parentf47c42bb10cd3291ce966be7b209b422646dff19 (diff)
better error checking when writing downloaded file.
-rw-r--r--indra/viewer_components/updater/llupdatedownloader.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp
index ab441aa747..eccc25aeee 100644
--- a/indra/viewer_components/updater/llupdatedownloader.cpp
+++ b/indra/viewer_components/updater/llupdatedownloader.cpp
@@ -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;
+ }
}