oops - state must be popped before writing indent

otherwise the closing } on non-empty objects is incorrectly indented
This commit is contained in:
Kae 2024-04-18 08:46:48 +10:00
parent 5d9108c469
commit 5bf3b20542

View File

@ -521,12 +521,13 @@ public:
} }
void endObject() { void endObject() {
if (currentState() == ObjectElement) { bool isNotEmpty = currentState() == ObjectElement;
popState(Object);
if (isNotEmpty) {
if (m_pretty) if (m_pretty)
write('\n'); write('\n');
indent(); indent();
} }
popState(Object);
write('}'); write('}');
} }