From 5bf3b20542c62c656cf90c71774189b7ab69fef5 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Thu, 18 Apr 2024 08:46:48 +1000 Subject: [PATCH] oops - state must be popped before writing indent otherwise the closing } on non-empty objects is incorrectly indented --- source/core/StarJsonParser.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/core/StarJsonParser.hpp b/source/core/StarJsonParser.hpp index c7a9cc6..d814edb 100644 --- a/source/core/StarJsonParser.hpp +++ b/source/core/StarJsonParser.hpp @@ -521,12 +521,13 @@ public: } void endObject() { - if (currentState() == ObjectElement) { + bool isNotEmpty = currentState() == ObjectElement; + popState(Object); + if (isNotEmpty) { if (m_pretty) write('\n'); indent(); } - popState(Object); write('}'); }