👌 fix operator[]

parent 04a0a071
...@@ -3654,6 +3654,13 @@ class basic_json ...@@ -3654,6 +3654,13 @@ class basic_json
if (idx >= m_value.array->size()) if (idx >= m_value.array->size())
{ {
#if JSON_DIAGNOSTICS #if JSON_DIAGNOSTICS
// remember array size before resizing
const auto previous_size = m_value.array->size();
#endif
m_value.array->resize(idx + 1);
#if JSON_DIAGNOSTICS
// set parent for values added above // set parent for values added above
for (auto i = previous_size; i <= idx; ++i) for (auto i = previous_size; i <= idx; ++i)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment