From 3133d0c03c3daa8c25155c0fe29bb3bb22962c9d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 31 Aug 2018 19:27:11 +1000 Subject: [PATCH] Fix swaybars with no defined output --- sway/ipc-json.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 9a9559916..abc4a0866 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -485,13 +485,13 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) { json_object_object_add(json, "colors", colors); // Add outputs if defined - json_object *outputs = json_object_new_array(); if (bar->outputs && bar->outputs->length > 0) { + json_object *outputs = json_object_new_array(); for (int i = 0; i < bar->outputs->length; ++i) { const char *name = bar->outputs->items[i]; json_object_array_add(outputs, json_object_new_string(name)); } + json_object_object_add(json, "outputs", outputs); } - json_object_object_add(json, "outputs", outputs); return json; }