diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-21 12:21:41 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-23 12:25:40 +0200 |
commit | b5211b9b213273c642a790ae3c3f3bbe1a4cf51e (patch) | |
tree | 64004aed27d7b5a4618aee12ed9b7df608ca343b /apt-private | |
parent | 09e3c0c855e339216784a1d43715c3ae2d79ec23 (diff) |
json: Encode NULL strings as null
This is the only nullable thing we have here.
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-json-hooks.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apt-private/private-json-hooks.cc b/apt-private/private-json-hooks.cc index ce1665b18..7991a7d77 100644 --- a/apt-private/private-json-hooks.cc +++ b/apt-private/private-json-hooks.cc @@ -141,7 +141,10 @@ class APT_HIDDEN JsonWriter JsonWriter &value(const char *value) { maybeComma(); - encodeString(os, value); + if (value == nullptr) + os << "null"; + else + encodeString(os, value); return *this; } JsonWriter &value(int value) |