mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 14:52:55 +00:00
json: write null on abnormal placeholder destruction
Avoids leaving dangling attributes like { "foo": } in case of exceptions.
This commit is contained in:
parent
7aa36ae796
commit
8188b1d0ab
@ -193,7 +193,11 @@ JSONObject JSONPlaceholder::object()
|
||||
|
||||
JSONPlaceholder::~JSONPlaceholder()
|
||||
{
|
||||
assert(!first || std::uncaught_exceptions());
|
||||
if (first) {
|
||||
assert(std::uncaught_exceptions());
|
||||
if (state->stack != 0)
|
||||
write(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user