Fix null characters in status json

This commit is contained in:
Gabriel Augendre 2023-01-06 15:28:50 +01:00
parent a9ca2150d4
commit 4d5122eb24

View file

@ -28,7 +28,8 @@ void onStatus(AsyncWebServerRequest *request)
AsyncResponseStream *response = request->beginResponseStream("application/json"); AsyncResponseStream *response = request->beginResponseStream("application/json");
StaticJsonDocument<96> root; 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"); JsonObject volume = root.createNestedObject("volume");
byte currentVolume = preferences.getUChar(CURRENT_VOLUME); byte currentVolume = preferences.getUChar(CURRENT_VOLUME);