Use suggested error handling
This commit is contained in:
parent
a0bafa4952
commit
1ff459d995
@ -1,4 +1,5 @@
|
|||||||
#include "Parsers.h"
|
#include "Parsers.h"
|
||||||
|
#include "Json.h"
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
@ -285,7 +286,7 @@ bool parseMinecraftProfileMojang(QByteArray & data, MinecraftProfile &output) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto obj = doc.object();
|
auto obj = Json::requireObject(doc, "mojang minecraft profile");
|
||||||
if(!getString(obj.value("id"), output.id)) {
|
if(!getString(obj.value("id"), output.id)) {
|
||||||
qWarning() << "Minecraft profile id is not a string";
|
qWarning() << "Minecraft profile id is not a string";
|
||||||
return false;
|
return false;
|
||||||
@ -330,7 +331,7 @@ bool parseMinecraftProfileMojang(QByteArray & data, MinecraftProfile &output) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = doc.object();
|
obj = Json::requireObject(doc, "session texture payload");
|
||||||
auto textures = obj.value("textures");
|
auto textures = obj.value("textures");
|
||||||
if (!textures.isObject()) {
|
if (!textures.isObject()) {
|
||||||
qWarning() << "No textures array in response";
|
qWarning() << "No textures array in response";
|
||||||
|
Loading…
Reference in New Issue
Block a user