From 459269e7a083bc90e448fe65d13b9d050fcd9412 Mon Sep 17 00:00:00 2001 From: Jozef Mlich Date: Sun, 29 Sep 2024 16:06:11 +0200 Subject: [PATCH] Bangle.js: Avoid crash when empty json comes --- daemon/src/services/uartservice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/src/services/uartservice.cpp b/daemon/src/services/uartservice.cpp index 260fa01d..8f06e1b6 100644 --- a/daemon/src/services/uartservice.cpp +++ b/daemon/src/services/uartservice.cpp @@ -56,7 +56,7 @@ void UARTService::handleRx(const QString &json) if (json.contains( "Uncaught ReferenceError: \"gb\" is not defined")) { emit message("Gadgetbridge plugin not installed on Bangle.js"); - } else if (json.at(0)=='{') { + } else if ((json.length() > 0) && (json.at(0)=='{')) { // JSON - we hope! QJsonObject obj = ObjectFromString(json); emit jsonRx(obj);