From 0b3af166ae069d8c29dd25b49bc7b738a28f02f9 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Sat, 6 Oct 2018 17:20:28 +0200 Subject: [PATCH] Fixed `JsonVariant::is()` (closes #763) --- CHANGELOG.md | 1 + src/ArduinoJson/JsonVariant.hpp | 6 ++++-- test/JsonVariant/is.cpp | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index feb2b888..4c11d228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ HEAD * Improved float serialization when `-fsingle-precision-constant` is used * Fixed `JsonVariant::is()` that returned true for empty strings +* Fixed `JsonVariant::is()` (closes #763) v5.13.2 ------- diff --git a/src/ArduinoJson/JsonVariant.hpp b/src/ArduinoJson/JsonVariant.hpp index 8326cbe8..43c51b77 100644 --- a/src/ArduinoJson/JsonVariant.hpp +++ b/src/ArduinoJson/JsonVariant.hpp @@ -274,9 +274,11 @@ class JsonVariant : public Internals::JsonVariantBase { // // bool is() const; // bool is() const; + // bool is() const; template typename Internals::EnableIf::value || - Internals::IsSame::value, + Internals::IsSame::value || + Internals::StringTraits::has_append, bool>::type is() const { return variantIsString(); @@ -352,4 +354,4 @@ DEPRECATED("Decimal places are ignored, use the double value instead") inline JsonVariant double_with_n_digits(double value, uint8_t) { return JsonVariant(value); } -} +} // namespace ArduinoJson diff --git a/test/JsonVariant/is.cpp b/test/JsonVariant/is.cpp index 1bb03cbb..c9837e2f 100644 --- a/test/JsonVariant/is.cpp +++ b/test/JsonVariant/is.cpp @@ -58,6 +58,7 @@ void checkIsInteger(JsonVariant var) { void checkIsString(JsonVariant var) { REQUIRE(var.is()); + REQUIRE(var.is()); REQUIRE_FALSE(var.is()); REQUIRE_FALSE(var.is());