Use Utils::checkJsonAlloc in ConfigurationClass

This commit is contained in:
Thomas Basler 2024-01-04 14:36:09 +01:00 committed by helgeerbe
parent f968179b60
commit 24c8a40fad

View File

@ -4,6 +4,7 @@
*/
#include "Configuration.h"
#include "MessageOutput.h"
#include "Utils.h"
#include "defaults.h"
#include <ArduinoJson.h>
#include <LittleFS.h>
@ -26,8 +27,7 @@ bool ConfigurationClass::write()
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
if (doc.capacity() == 0) {
MessageOutput.println("Failed to allocate memory");
if (!Utils::checkJsonAlloc(doc, __FUNCTION__, __LINE__)) {
return false;
}
@ -232,8 +232,7 @@ bool ConfigurationClass::read()
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
if (doc.capacity() == 0) {
MessageOutput.println("Failed to allocate memory");
if (!Utils::checkJsonAlloc(doc, __FUNCTION__, __LINE__)) {
return false;
}
@ -473,8 +472,7 @@ void ConfigurationClass::migrate()
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
if (doc.capacity() == 0) {
MessageOutput.println("Failed to allocate memory");
if (!Utils::checkJsonAlloc(doc, __FUNCTION__, __LINE__)) {
return;
}