Merge pull request #4223 from FearlessTobi/port-1301

Port #1301 from yuzu: "game_list: Resolve variable shadowing within LoadCompatibilityList()"
This commit is contained in:
Pengfei Zhu 2018-09-17 22:25:04 +08:00 committed by GitHub
commit 9a1446886c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -545,7 +545,7 @@ void GameList::LoadCompatibilityList() {
QJsonDocument json = QJsonDocument::fromJson(string_content.toUtf8()); QJsonDocument json = QJsonDocument::fromJson(string_content.toUtf8());
QJsonArray arr = json.array(); QJsonArray arr = json.array();
for (const QJsonValue& value : arr) { for (const QJsonValueRef& value : arr) {
QJsonObject game = value.toObject(); QJsonObject game = value.toObject();
if (game.contains("compatibility") && game["compatibility"].isDouble()) { if (game.contains("compatibility") && game["compatibility"].isDouble()) {
@ -553,9 +553,9 @@ void GameList::LoadCompatibilityList() {
QString directory = game["directory"].toString(); QString directory = game["directory"].toString();
QJsonArray ids = game["releases"].toArray(); QJsonArray ids = game["releases"].toArray();
for (const QJsonValue& value : ids) { for (const QJsonValueRef& id_ref : ids) {
QJsonObject object = value.toObject(); QJsonObject id_object = id_ref.toObject();
QString id = object["id"].toString(); QString id = id_object["id"].toString();
compatibility_list.emplace( compatibility_list.emplace(
id.toUpper().toStdString(), id.toUpper().toStdString(),
std::make_pair(QString::number(compatibility), directory)); std::make_pair(QString::number(compatibility), directory));