diff --git a/include/nlohmann/json_view.hpp b/include/nlohmann/json_view.hpp index 9df50d93b..b5af4852a 100644 --- a/include/nlohmann/json_view.hpp +++ b/include/nlohmann/json_view.hpp @@ -715,7 +715,7 @@ class basic_json_view /// decoded strings); the estimate sizes the output buffer of dump() std::size_t source_extent() const noexcept { - const node* const end = m_doc->tape + m_doc->tape_size; + const node* const end = m_doc->nodes + m_doc->node_count; if ((m_node->flags & detail::view::node_flags::storage) != 0) { return m_node->len; diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index 014cf9bff..a590c7fd5 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -4645,7 +4645,7 @@ class basic_json_view /// decoded strings); the estimate sizes the output buffer of dump() std::size_t source_extent() const noexcept { - const node* const end = m_doc->tape + m_doc->tape_size; + const node* const end = m_doc->nodes + m_doc->node_count; if ((m_node->flags & detail::view::node_flags::storage) != 0) { return m_node->len;