summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-06-18 09:58:03 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-06-18 09:58:03 +0000
commit08a369f6f9ee39f0b791fd8db3265864caf94b0d (patch)
tree265c3831472dc97f2e31eec55cde0e11712211fe /usr.bin/tmux
parent334a75572953c2c51b85ae9b5b657bd10a31c7ab (diff)
Add a couple of NULL pointer checks to key binding functions, from
jspenguin on SF bug 3535531.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/key-bindings.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c
index 3413f247663..8fe1f82654e 100644
--- a/usr.bin/tmux/key-bindings.c
+++ b/usr.bin/tmux/key-bindings.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-bindings.c,v 1.30 2012/04/01 13:18:38 nicm Exp $ */
+/* $OpenBSD: key-bindings.c,v 1.31 2012/06/18 09:58:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -207,6 +207,9 @@ key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
va_list ap;
char *msg;
+ if (ctx->curclient->session == NULL)
+ return;
+
va_start(ap, fmt);
xvasprintf(&msg, fmt, ap);
va_end(ap);
@@ -219,9 +222,13 @@ key_bindings_error(struct cmd_ctx *ctx, const char *fmt, ...)
void printflike2
key_bindings_print(struct cmd_ctx *ctx, const char *fmt, ...)
{
- struct winlink *wl = ctx->curclient->session->curw;
+ struct winlink *wl;
va_list ap;
+ if (ctx->curclient->session == NULL)
+ return;
+
+ wl = ctx->curclient->session->curw;
if (wl->window->active->mode != &window_copy_mode) {
window_pane_reset_mode(wl->window->active);
window_pane_set_mode(wl->window->active, &window_copy_mode);
@@ -239,6 +246,9 @@ key_bindings_info(struct cmd_ctx *ctx, const char *fmt, ...)
va_list ap;
char *msg;
+ if (ctx->curclient->session == NULL)
+ return;
+
if (options_get_number(&global_options, "quiet"))
return;