Fixed serialized() not working with Flash strings (fixes #1030)

This commit is contained in:
Benoit Blanchon
2019-06-21 08:46:05 +02:00
parent 59f9c9747f
commit ce247a5637
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,11 @@
ArduinoJson: change log ArduinoJson: change log
======================= =======================
HEAD
----
* Fixed `serialized()` not working with Flash strings (issue #1030)
v6.11.0 (2019-05-26) v6.11.0 (2019-05-26)
------- -------

View File

@ -29,7 +29,7 @@ class SizedFlashStringAdapter {
char* save(MemoryPool* pool) const { char* save(MemoryPool* pool) const {
if (!_str) return NULL; if (!_str) return NULL;
char* dup = pool->allocFrozenString(_size); char* dup = pool->allocFrozenString(_size);
if (!dup) memcpy_P(dup, (const char*)_str, _size); if (dup) memcpy_P(dup, (const char*)_str, _size);
return dup; return dup;
} }