mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-15 03:26:39 +02:00
Fixed null values that could be pass to strcmp()
(closes #745)
This commit is contained in:
@ -149,4 +149,15 @@ TEST_CASE("JsonObject::operator[]") {
|
||||
const size_t expectedSize = JSON_OBJECT_SIZE(1) + 12;
|
||||
REQUIRE(expectedSize <= _jsonBuffer.size());
|
||||
}
|
||||
|
||||
SECTION("should ignore null key") {
|
||||
// object must have a value to make a call to strcmp()
|
||||
_object["dummy"] = 42;
|
||||
|
||||
const char* null = 0;
|
||||
_object[null] = 666;
|
||||
|
||||
REQUIRE(_object.size() == 1);
|
||||
REQUIRE(_object[null] == 0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user