aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrondog <crondog@gmail.com>2016-03-31 20:50:07 +1100
committercrondog <crondog@gmail.com>2016-03-31 20:56:14 +1100
commit9c42557b66d29574784ba26b34a50356c7894a60 (patch)
treec3cb1c760a51b82a25b857bd9f6bb01f6b8aa73b
parent0169ba02fa9a6e1900a36402a440d2688f79a668 (diff)
Stop swaybar crashing without args
-rw-r--r--swaybar/bar.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index b6329123..94ed9dac 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -199,9 +199,17 @@ static void terminate_status_command(pid_t pid) {
}
void bar_teardown(struct bar *bar) {
- free_config(bar->config);
- free_outputs(bar->outputs);
- free_status_line(bar->status);
+ if (bar->config) {
+ free_config(bar->config);
+ }
+
+ if (bar->outputs) {
+ free_outputs(bar->outputs);
+ }
+
+ if (bar->status) {
+ free_status_line(bar->status);
+ }
/* close sockets/pipes */
if (bar->status_read_fd) {