summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-if-shell.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-04-22 06:27:15 +0000
committernicm <nicm@openbsd.org>2017-04-22 06:27:15 +0000
commitcb1db41502bb3264179bd85b553e3ed32430a86a (patch)
tree49f71c2178c17804a7ef37981022e497d89cdcb5 /usr.bin/tmux/cmd-if-shell.c
parentTypo in example. (diff)
downloadwireguard-openbsd-cb1db41502bb3264179bd85b553e3ed32430a86a.tar.xz
wireguard-openbsd-cb1db41502bb3264179bd85b553e3ed32430a86a.zip
Fix if-shell without a client (so in the config file). Reported by Theo
Buehler.
Diffstat (limited to 'usr.bin/tmux/cmd-if-shell.c')
-rw-r--r--usr.bin/tmux/cmd-if-shell.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c
index eec73e572d9..1c5696dc726 100644
--- a/usr.bin/tmux/cmd-if-shell.c
+++ b/usr.bin/tmux/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-if-shell.c,v 1.53 2017/04/21 14:01:19 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.54 2017/04/22 06:27:15 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -120,7 +120,8 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
cdata->cmd_else = NULL;
cdata->client = item->client;
- cdata->client->references++;
+ if (cdata->client != NULL)
+ cdata->client->references++;
if (!args_has(args, 'b'))
cdata->item = item;
@@ -193,7 +194,8 @@ cmd_if_shell_free(void *data)
{
struct cmd_if_shell_data *cdata = data;
- server_client_unref(cdata->client);
+ if (cdata->client != NULL)
+ server_client_unref(cdata->client);
free(cdata->cmd_else);
free(cdata->cmd_if);