From 9e53440cb2dbcfd4311ce2566eb98839383738c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 12 Mar 2012 23:02:57 +0300 Subject: Fix servers list download error. --- src/net/download.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/net') diff --git a/src/net/download.cpp b/src/net/download.cpp index d20713dfa..bc8ea4f72 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -306,16 +306,19 @@ int Download::downloadThread(void *ptr) // Any existing file with this name is deleted first, otherwise // the rename will fail on Windows. - ::remove(d->mFileName.c_str()); - ::rename(outFilename.c_str(), d->mFileName.c_str()); - - // Check if we can open it and no errors were encountered - // during renaming - file = fopen(d->mFileName.c_str(), "rb"); - if (file) + if (!d->mOptions.cancel) { - fclose(file); - complete = true; + ::remove(d->mFileName.c_str()); + ::rename(outFilename.c_str(), d->mFileName.c_str()); + + // Check if we can open it and no errors were encountered + // during renaming + file = fopen(d->mFileName.c_str(), "rb"); + if (file) + { + fclose(file); + complete = true; + } } } else -- cgit v1.2.3-70-g09d2