272 | @@ -273,8 +273,10 @@ class GetinfoRequestHandler: public BaseRequestHandler
273 | result.pushKV("timeoffset", batch[ID_NETWORKINFO]["result"]["timeoffset"]);
274 |
275 | UniValue connections(UniValue::VOBJ);
276 | - connections.pushKV("in", batch[ID_NETWORKINFO]["result"]["connections_in"]);
277 | - connections.pushKV("out", batch[ID_NETWORKINFO]["result"]["connections_out"]);
278 | + const UniValue in{batch[ID_NETWORKINFO]["result"]["connections_in"]};
279 | + const UniValue out{batch[ID_NETWORKINFO]["result"]["connections_out"]};
280 | + if (!in.isNull()) connections.pushKV("in", in);
If we do this, I'd prefer to add a comment describing why these isNull checks are done for these fields and not for, say connections itself. It won't be obvious in the future.