From d77051706b76818825e9ae23302e565e24f077eb Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 24 Mar 2021 20:32:25 +0100 Subject: [PATCH] :bug: add missing negation --- single_include/nlohmann/json.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index adfe95058..790fa47b0 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -20313,7 +20313,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec reference at(const KeyType& key) { // at only works for objects - if (JSON_HEDLEY_UNLIKELY(is_object())) + if (JSON_HEDLEY_UNLIKELY(!is_object())) { JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()), *this)); } @@ -20364,7 +20364,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec const_reference at(const KeyType& key) const { // at only works for objects - if (JSON_HEDLEY_UNLIKELY(is_object())) + if (JSON_HEDLEY_UNLIKELY(!is_object())) { JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name()), *this)); }