Launcher: Make JSON parsing more robust

This commit is contained in:
UnknownShadow200 2024-12-16 19:17:45 +11:00
parent d4c13858a5
commit d4cc8d442c
2 changed files with 9 additions and 1 deletions

View file

@ -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

View file

@ -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) {