From b5211b9b213273c642a790ae3c3f3bbe1a4cf51e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 21 Apr 2021 12:21:41 +0200 Subject: json: Encode NULL strings as null This is the only nullable thing we have here. --- apt-private/private-json-hooks.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-private') 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) -- cgit v1.2.3-70-g09d2