mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Launcher: Make JSON parsing more robust
This commit is contained in:
parent
d4c13858a5
commit
d4cc8d442c
2 changed files with 9 additions and 1 deletions
|
@ -103,6 +103,10 @@ add_library(classicube SHARED
|
||||||
../../src/AudioBackend.c
|
../../src/AudioBackend.c
|
||||||
../../src/TouchUI.c
|
../../src/TouchUI.c
|
||||||
../../src/LBackend_Android.c
|
../../src/LBackend_Android.c
|
||||||
|
../../src/InputHandler.c
|
||||||
|
../../src/MenuOptions.c
|
||||||
|
../../src/FancyLighting.c
|
||||||
|
../../src/Queue.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# add lib dependencies
|
# add lib dependencies
|
||||||
|
|
|
@ -67,6 +67,7 @@ static int Json_ConsumeToken(struct JsonContext* ctx) {
|
||||||
|
|
||||||
/* invalid token */
|
/* invalid token */
|
||||||
JsonContext_Consume(ctx, 1);
|
JsonContext_Consume(ctx, 1);
|
||||||
|
ctx->failed = true;
|
||||||
return TOKEN_NONE;
|
return TOKEN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +342,10 @@ static void SignInTask_Handle(cc_uint8* data, cc_uint32 len) {
|
||||||
static cc_string err_msg = String_FromConst("Error parsing sign in response JSON");
|
static cc_string err_msg = String_FromConst("Error parsing sign in response JSON");
|
||||||
|
|
||||||
cc_bool success = Json_Handle(data, len, SignInTask_OnValue, NULL, NULL);
|
cc_bool success = Json_Handle(data, len, SignInTask_OnValue, NULL, NULL);
|
||||||
if (!success) Logger_WarnFunc(&err_msg);
|
if (success) return;
|
||||||
|
|
||||||
|
SignInTask.error = err_msg.buffer;
|
||||||
|
Logger_WarnFunc(&err_msg);;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SignInTask_Append(cc_string* dst, const char* key, const cc_string* value) {
|
static void SignInTask_Append(cc_string* dst, const char* key, const cc_string* value) {
|
||||||
|
|
Loading…
Reference in a new issue