From fc38454a224c778f5f8b0b82b62e25359649745b Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 23 Mar 2021 13:10:13 +0100 Subject: [PATCH] :rotating_light: fix warning --- include/nlohmann/json.hpp | 10 +++++++--- single_include/nlohmann/json.hpp | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 2fc49dde3..8dc9a348b 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -1247,10 +1247,14 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec JSON_ASSERT(m_type != value_t::binary || m_value.binary != nullptr); #if JSON_DIAGNOSTICS - JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j) + try { - return j.m_parent == this; - })); + JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j) + { + return j.m_parent == this; + })); + } + catch (..) {} #else static_cast(check_parents); #endif diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 54880efd6..8407110b5 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18060,10 +18060,14 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec JSON_ASSERT(m_type != value_t::binary || m_value.binary != nullptr); #if JSON_DIAGNOSTICS - JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j) + try { - return j.m_parent == this; - })); + JSON_ASSERT(!check_parents || !is_structured() || std::all_of(begin(), end(), [this](const basic_json & j) + { + return j.m_parent == this; + })); + } + catch (..) {} #else static_cast(check_parents); #endif