Merge pull request #9149 from s-hadinger/zigbee_26_dev

Zigbee keep 'null' attributes
This commit is contained in:
Theo Arends 2020-08-23 15:14:33 +02:00 committed by GitHub
commit 60a5728bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -818,8 +818,8 @@ void CopyJsonVariant(JsonObject &to, const String &key, const JsonVariant &val)
to.remove(key); // force remove to have metadata like LinkQuality at the end to.remove(key); // force remove to have metadata like LinkQuality at the end
if (val.is<char*>()) { if (val.is<char*>()) {
String sval = val.as<String>(); // force a copy of the String value, avoiding crash const char * sval = val.as<char*>(); // using char* forces a copy, and also captures 'null' values
to.set(key, sval); to.set(key, (char*) sval);
} else if (val.is<JsonArray>()) { } else if (val.is<JsonArray>()) {
JsonArray &nested_arr = to.createNestedArray(key); JsonArray &nested_arr = to.createNestedArray(key);
CopyJsonArray(nested_arr, val.as<JsonArray>()); // deep copy CopyJsonArray(nested_arr, val.as<JsonArray>()); // deep copy