mirror of
https://github.com/nlohmann/json.git
synced 2026-10-21 05:28:12 +00:00
Bind the serializer's frame only after the check for its end
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 file changed
+3
-3
@@ -174,15 +174,15 @@ class view_serializer
|
||||
m_out.finish();
|
||||
return;
|
||||
}
|
||||
frame& f = stack.back();
|
||||
if (f.pos == f.end)
|
||||
if (stack.back().pos == stack.back().end)
|
||||
{
|
||||
const bool object = f.object; // (f dangles after pop_back)
|
||||
const bool object = stack.back().object;
|
||||
stack.pop_back();
|
||||
newline(stack.size());
|
||||
m_out.put(object ? '}' : ']');
|
||||
continue;
|
||||
}
|
||||
frame& f = stack.back();
|
||||
if (!f.first)
|
||||
{
|
||||
m_out.put(',');
|
||||
|
||||
Reference in new issue
Block a user