From ae91c28cb02ac19676775342c71391ae98bc1a94 Mon Sep 17 00:00:00 2001 From: Sude Date: Mon, 5 Jan 2015 06:29:32 +0200 Subject: [PATCH] Possible fix for crash in Downloader::checkStatus --- src/downloader.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/downloader.cpp b/src/downloader.cpp index cdebc6e..f814b17 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -2461,7 +2461,7 @@ void Downloader::checkStatus() localHash = this->getLocalFileHash(filepath.string(), games[i].gamename); remoteHash = this->getRemoteFileHash(games[i].gamename, games[i].installers[j].id); - if (boost::filesystem::exists(filepath)) + if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath)) { filesize = boost::filesystem::file_size(filepath); @@ -2486,7 +2486,7 @@ void Downloader::checkStatus() std::string localHash = this->getLocalFileHash(filepath.string(), games[i].gamename); size_t filesize; - if (boost::filesystem::exists(filepath)) + if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath)) { filesize = boost::filesystem::file_size(filepath); std::cout << "OK " << games[i].gamename << " " << filepath.filename().string() << " " << filesize << " " << localHash << std::endl; @@ -2507,7 +2507,7 @@ void Downloader::checkStatus() std::string localHash = this->getLocalFileHash(filepath.string(), games[i].gamename); size_t filesize; - if (boost::filesystem::exists(filepath)) + if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath)) { filesize = boost::filesystem::file_size(filepath); std::cout << "OK " << games[i].gamename << " " << filepath.filename().string() << " " << filesize << " " << localHash << std::endl; @@ -2528,7 +2528,7 @@ void Downloader::checkStatus() std::string localHash = this->getLocalFileHash(filepath.string(), games[i].gamename); size_t filesize; - if (boost::filesystem::exists(filepath)) + if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath)) { filesize = boost::filesystem::file_size(filepath); std::cout << "OK " << games[i].gamename << " " << filepath.filename().string() << " " << filesize << " " << localHash << std::endl; @@ -2558,7 +2558,7 @@ void Downloader::checkStatus() localHash = this->getLocalFileHash(filepath.string(), games[i].dlcs[j].gamename); remoteHash = this->getRemoteFileHash(games[i].dlcs[j].gamename, games[i].dlcs[j].installers[k].id); - if (boost::filesystem::exists(filepath)) + if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath)) { filesize = boost::filesystem::file_size(filepath); @@ -2583,7 +2583,7 @@ void Downloader::checkStatus() std::string localHash = this->getLocalFileHash(filepath.string(), games[i].dlcs[j].gamename); size_t filesize; - if (boost::filesystem::exists(filepath)) + if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath)) { filesize = boost::filesystem::file_size(filepath); std::cout << "OK " << games[i].gamename << " " << filepath.filename().string() << " " << filesize << " " << localHash << std::endl; @@ -2604,7 +2604,7 @@ void Downloader::checkStatus() std::string localHash = this->getLocalFileHash(filepath.string(), games[i].dlcs[j].gamename); size_t filesize; - if (boost::filesystem::exists(filepath)) + if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath)) { filesize = boost::filesystem::file_size(filepath); std::cout << "OK " << games[i].gamename << " " << filepath.filename().string() << " " << filesize << " " << localHash << std::endl;