From 4d5122eb247711066bafe51f572e5145e4faa303 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Fri, 6 Jan 2023 15:28:50 +0100 Subject: [PATCH] Fix null characters in status json --- src/webHandlers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/webHandlers.cpp b/src/webHandlers.cpp index ca6a6eb..0a4eb3f 100644 --- a/src/webHandlers.cpp +++ b/src/webHandlers.cpp @@ -28,7 +28,8 @@ void onStatus(AsyncWebServerRequest *request) AsyncResponseStream *response = request->beginResponseStream("application/json"); StaticJsonDocument<96> root; - root["files"]["selected"] = preferences.getString(SELECTED_FILE, "").c_str(); + String file = preferences.getString(SELECTED_FILE, ""); + root["files"]["selected"] = file.c_str(); JsonObject volume = root.createNestedObject("volume"); byte currentVolume = preferences.getUChar(CURRENT_VOLUME);