format-table: when generating json, synthesize "null" for invalid ifindex

This matches what we do for other cell types that have an invalid value.
This commit is contained in:
Lennart Poettering
2021-02-10 12:21:56 +01:00
parent a7273eaf32
commit 56909de015
+3
View File
@@ -2478,6 +2478,9 @@ static int table_data_to_json(TableData *d, JsonVariant **ret) {
return json_variant_new_integer(ret, d->percent);
case TABLE_IFINDEX:
if (d->ifindex <= 0)
return json_variant_new_null(ret);
return json_variant_new_integer(ret, d->ifindex);
case TABLE_IN_ADDR: