diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index f24584aa2..b94a72bdd 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -6482,6 +6482,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec enter(source, target); while (!stack.empty()) { + // invalidated when enter() pushes a frame and by the pop_back() + // at the end, so not used after either diff_frame& frame = stack.back(); const std::size_t path_length = frame.path_length; const std::size_t depth = stack.size(); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 14ce2f8d4..821026282 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -31440,6 +31440,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec enter(source, target); while (!stack.empty()) { + // invalidated when enter() pushes a frame and by the pop_back() + // at the end, so not used after either diff_frame& frame = stack.back(); const std::size_t path_length = frame.path_length; const std::size_t depth = stack.size();