From bb529e6fd0bcbd69f804c599c9d685181560a337 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Tue, 26 Jul 2016 15:04:56 +0600 Subject: CLOUD: Update SavesSyncRequest Add JSON checks in the callback. --- backends/cloud/savessyncrequest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'backends/cloud/savessyncrequest.cpp') diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index 889c6b936b..9c487bb987 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -22,6 +22,8 @@ #include "backends/cloud/savessyncrequest.h" #include "backends/cloud/cloudmanager.h" +#include "backends/networking/curl/curljsonrequest.h" +#include "backends/saves/default/default-saves.h" #include "common/config-manager.h" #include "common/debug.h" #include "common/file.h" @@ -29,7 +31,6 @@ #include "common/savefile.h" #include "common/system.h" #include "gui/saveload-dialog.h" -#include namespace Cloud { @@ -152,7 +153,7 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er Common::JSONObject object = value->asObject(); //Dropbox-related error: - if (object.contains("error_summary")) { + if (Networking::CurlJsonRequest::jsonContainsString(object, "error_summary", "SavesSyncRequest", true)) { Common::String summary = object.getVal("error_summary")->asString(); if (summary.contains("not_found")) { irrecoverable = false; @@ -160,9 +161,9 @@ void SavesSyncRequest::directoryListedErrorCallback(Networking::ErrorResponse er } //OneDrive-related error: - if (object.contains("error") && object.getVal("error")->isObject()) { + if (Networking::CurlJsonRequest::jsonContainsObject(object, "error", "SavesSyncRequest", true)) { Common::JSONObject errorNode = object.getVal("error")->asObject(); - if (errorNode.contains("code") && errorNode.contains("message")) { + if (Networking::CurlJsonRequest::jsonContainsString(errorNode, "code", "SavesSyncRequest")) { Common::String code = errorNode.getVal("code")->asString(); if (code == "itemNotFound") { irrecoverable = false; -- cgit v1.2.3