Do not crash if display-message used without a client, issue reported by
authornicm <nicm@openbsd.org>
Thu, 25 Aug 2016 09:33:14 +0000 (09:33 +0000)
committernicm <nicm@openbsd.org>
Thu, 25 Aug 2016 09:33:14 +0000 (09:33 +0000)
Serge Aleynikov, fix from Thomas Adam.

usr.bin/tmux/cmd-display-message.c

index f0a0317..4507b15 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-display-message.c,v 1.35 2015/12/14 00:31:54 nicm Exp $ */
+/* $OpenBSD: cmd-display-message.c,v 1.36 2016/08/25 09:33:14 nicm Exp $ */
 
 /*
  * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -78,9 +78,10 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
        msg = format_expand_time(ft, template, time(NULL));
        if (args_has(self->args, 'p'))
                cmdq_print(cmdq, "%s", msg);
-       else
+       else if (c != NULL)
                status_message_set(c, "%s", msg);
        free(msg);
+
        format_free(ft);
 
        return (CMD_RETURN_NORMAL);