Upravy pro nejnovejsi ArduinoJson 7.2.1
This commit is contained in:
parent
a42ee82a3a
commit
549a215403
@ -27,7 +27,7 @@ T svGetV(const String & name, const T deflt)
|
||||
if (err) {
|
||||
TRACEPLUS(DEBUG_SYSVARS, TRACE_ERROR, "SV: Deserialize error '%s'", err.c_str()); // wrong JSON file (malformed)
|
||||
} else {
|
||||
if (!doc.containsKey(name)) {
|
||||
if (!doc[name].is<JsonVariant>()) { // key not found
|
||||
TRACEPLUS(DEBUG_SYSVARS, TRACE_ERROR, "SV: Key '%s' not found", name.c_str());
|
||||
} else {
|
||||
rv = doc[name].as<T>();
|
||||
@ -52,7 +52,7 @@ T svGetVFile(const String & name, const String & fname, const T deflt)
|
||||
if (err) {
|
||||
TRACEPLUS(DEBUG_SYSVARS, TRACE_ERROR, "SV: Deserialize error '%s'", err.c_str()); // wrong JSON file (malformed)
|
||||
} else {
|
||||
if (!doc.containsKey(name)) {
|
||||
if (!doc[name].is<JsonVariant>()) {
|
||||
TRACEPLUS(DEBUG_SYSVARS, TRACE_ERROR, "SV: Key '%s' not found", name.c_str());
|
||||
} else {
|
||||
rv = doc[name].as<T>();
|
||||
@ -119,8 +119,7 @@ int svSetVFile(const String & name, T value, const String & fname)
|
||||
File f = USEDFS.open(fname, "r");
|
||||
|
||||
if (f) {
|
||||
const DeserializationError err = deserializeJson(doc, f);
|
||||
if (err) {
|
||||
if (const DeserializationError err = deserializeJson(doc, f)) {
|
||||
res = SV_DESERIALIZE_ERROR; // wrong (malformed) JSON file
|
||||
}
|
||||
f.close();
|
||||
|
Loading…
Reference in New Issue
Block a user