Skip to content

Commit

Permalink
Check if json has serials node and check if it is empty
Browse files Browse the repository at this point in the history
Fixes downloader creating serials.txt even if the game didn't have any serials
  • Loading branch information
Sude- committed May 13, 2015
1 parent 5af5a28 commit 3e0c36b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/downloader.cpp
Expand Up @@ -2243,7 +2243,14 @@ std::string Downloader::getSerialsFromJSON(const Json::Value& json)
{
std::ostringstream serials;

if (!json.isMember("cdKey"))
return std::string();

std::string cdkey = json["cdKey"].asString();

if (cdkey.empty())
return std::string();

if (cdkey.find("<span>") == std::string::npos)
{
serials << cdkey << std::endl;
Expand Down

0 comments on commit 3e0c36b

Please sign in to comment.