From d4cc8d442c0da4262bd4ba9ee1f408590a18df6f Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 16 Dec 2024 19:17:45 +1100 Subject: [PATCH] Launcher: Make JSON parsing more robust --- android/app/CMakeLists.txt | 4 ++++ src/LWeb.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/android/app/CMakeLists.txt b/android/app/CMakeLists.txt index ef21c0e22..46037d50d 100644 --- a/android/app/CMakeLists.txt +++ b/android/app/CMakeLists.txt @@ -103,6 +103,10 @@ add_library(classicube SHARED ../../src/AudioBackend.c ../../src/TouchUI.c ../../src/LBackend_Android.c + ../../src/InputHandler.c + ../../src/MenuOptions.c + ../../src/FancyLighting.c + ../../src/Queue.c ) # add lib dependencies diff --git a/src/LWeb.c b/src/LWeb.c index 8ffef0e36..e5479b5f6 100644 --- a/src/LWeb.c +++ b/src/LWeb.c @@ -67,6 +67,7 @@ static int Json_ConsumeToken(struct JsonContext* ctx) { /* invalid token */ JsonContext_Consume(ctx, 1); + ctx->failed = true; 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"); 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) {