8000 Fixed `JsonObject` not inserting keys of type `String` (fixes #782) · java64/ArduinoJson@6e4f1dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 6e4f1dc

Browse files
committed
Fixed JsonObject not inserting keys of type String (fixes bblanchon#782)
1 parent dc13882 commit 6e4f1dc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
ArduinoJson: change log
22
=======================
33

4+
HEAD
5+
----
6+
7+
* Fixed `JsonObject` not inserting keys of type `String` (issue #782)
8+
49
v6.2.0-beta
510
-----------
611

src/ArduinoJson/Strings/ArduinoString.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ArduinoString {
1515

1616
template <typename Buffer>
1717
const char* save(Buffer* buffer) const {
18-
if (!_str->c_str()) return NULL; // <- Arduino string can return NULL
18+
if (is_null()) return NULL;
1919
size_t n = _str->length() + 1;
2020
void* dup = buffer->alloc(n);
2121
if (dup != NULL) memcpy(dup, _str->c_str(), n);
@@ -24,7 +24,7 @@ class ArduinoString {
2424

2525
bool is_null() const {
2626
// Arduino's String::c_str() can return NULL
27-
return _str->c_str();
27+
return !_str->c_str();
2828
}
2929

3030
bool equals(const char* expected) const {

0 commit comments

Comments
 (0)
0