From 549a215403912a32dedf32ada1e26e7a2a72a783 Mon Sep 17 00:00:00 2001 From: Pablo2048 Date: Thu, 5 Dec 2024 10:34:29 +0100 Subject: [PATCH] Upravy pro nejnovejsi ArduinoJson 7.2.1 --- src/sysvars.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/sysvars.cpp b/src/sysvars.cpp index 60865b9..a29ea2b 100644 --- a/src/sysvars.cpp +++ b/src/sysvars.cpp @@ -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()) { // key not found TRACEPLUS(DEBUG_SYSVARS, TRACE_ERROR, "SV: Key '%s' not found", name.c_str()); } else { rv = doc[name].as(); @@ -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()) { TRACEPLUS(DEBUG_SYSVARS, TRACE_ERROR, "SV: Key '%s' not found", name.c_str()); } else { rv = doc[name].as(); @@ -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();