Fix preferences load bug

This commit is contained in:
Spacehuhn 2022-11-22 20:23:26 +01:00
parent 9e20e027b7
commit a67e9f864a
1 changed files with 3 additions and 1 deletions

View File

@ -102,8 +102,10 @@ namespace preferences {
// Open the file and read it into a buffer
if (!msc::open(PREFERENCES_PATH), false) return;
msc::read(buffer, JSON_SIZE);
size_t read = msc::read(buffer, JSON_SIZE);
msc::close();
buffer[read] = '\0';
// Deserialize the JSON document
DeserializationError error = deserializeJson(config_doc, buffer);