aboutsummaryrefslogtreecommitdiff
path: root/sway/ipc-json.c
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-08-31 19:27:11 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-09-05 18:01:43 +1000
commit3133d0c03c3daa8c25155c0fe29bb3bb22962c9d (patch)
tree816eecc8da9eb0375e9b0597bb8297e87ee3ed25 /sway/ipc-json.c
parenteccfcde2ebf8d54f181825db04e27a3898983de4 (diff)
Fix swaybars with no defined output
Diffstat (limited to 'sway/ipc-json.c')
-rw-r--r--sway/ipc-json.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index 9a955991..abc4a086 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;
}