Merge pull request #531 from Spongman/patch-1

Update GamesDBJSONScraper.cpp
This commit is contained in:
Jools Wills 2019-02-19 05:53:29 +00:00 committed by GitHub
commit b7bec0eb87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -322,12 +322,16 @@ void processGame(const Value& game, const Value& boxart, std::vector<ScraperSear
result.mdl.set("players", std::to_string(game["players"].GetInt()));
}
std::string id = std::to_string(getIntOrThrow(game, "id"));
if (boxart["data"].HasMember(id.c_str()))
if (boxart.HasMember("data") && boxart["data"].IsObject())
{
std::string image = getBoxartImage(boxart["data"][id.c_str()]);
result.thumbnailUrl = baseImageUrlThumb + "/" + image;
result.imageUrl = baseImageUrlLarge + "/" + image;
std::string id = std::to_string(getIntOrThrow(game, "id"));
if (boxart["data"].HasMember(id.c_str()))
{
std::string image = getBoxartImage(boxart["data"][id.c_str()]);
result.thumbnailUrl = baseImageUrlThumb + "/" + image;
result.imageUrl = baseImageUrlLarge + "/" + image;
}
}
results.push_back(result);