forked from bblanchon/ArduinoJson
Fixed JsonObject
not inserting keys of type String
(fixes #782)
This commit is contained in:
@ -1,6 +1,11 @@
|
|||||||
ArduinoJson: change log
|
ArduinoJson: change log
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
----
|
||||||
|
|
||||||
|
* Fixed `JsonObject` not inserting keys of type `String` (issue #782)
|
||||||
|
|
||||||
v6.2.0-beta
|
v6.2.0-beta
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class ArduinoString {
|
|||||||
|
|
||||||
template <typename Buffer>
|
template <typename Buffer>
|
||||||
const char* save(Buffer* buffer) const {
|
const char* save(Buffer* buffer) const {
|
||||||
if (!_str->c_str()) return NULL; // <- Arduino string can return NULL
|
if (is_null()) return NULL;
|
||||||
size_t n = _str->length() + 1;
|
size_t n = _str->length() + 1;
|
||||||
void* dup = buffer->alloc(n);
|
void* dup = buffer->alloc(n);
|
||||||
if (dup != NULL) memcpy(dup, _str->c_str(), n);
|
if (dup != NULL) memcpy(dup, _str->c_str(), n);
|
||||||
@ -24,7 +24,7 @@ class ArduinoString {
|
|||||||
|
|
||||||
bool is_null() const {
|
bool is_null() const {
|
||||||
// Arduino's String::c_str() can return NULL
|
// Arduino's String::c_str() can return NULL
|
||||||
return _str->c_str();
|
return !_str->c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool equals(const char* expected) const {
|
bool equals(const char* expected) const {
|
||||||
|
Reference in New Issue
Block a user