From 4997a455970f017b700267f4a514262d200cafcc Mon Sep 17 00:00:00 2001 From: Sude Date: Wed, 8 Apr 2020 09:41:21 +0300 Subject: [PATCH] Check that product id selection was successful in Downloader::downloadFileWithId Fixes possible issue where downloader tries to get product info even though it failed to get valid product id beforehand --- src/downloader.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/downloader.cpp b/src/downloader.cpp index dae2b02..6968ab8 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -2384,13 +2384,12 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: fileid.assign(fileid_string.begin()+pos+1, fileid_string.end()); std::string product_id; - if(this->galaxySelectProductIdHelper(gamename, product_id)) + bool bSelectOK = this->galaxySelectProductIdHelper(gamename, product_id); + + if (!bSelectOK || product_id.empty()) { - if (product_id.empty()) - { - std::cerr << "Failed to get numerical product id" << std::endl; - return 1; - } + std::cerr << "Failed to get numerical product id" << std::endl; + return 1; } Json::Value productInfo = gogGalaxy->getProductInfo(product_id);