aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-06-18 15:15:32 +0000
committerTiago Cunha <tcunha@gmx.com>2012-06-18 15:15:32 +0000
commitfce30422f35865c0a5a24f63dde604329f12792e (patch)
treede3a4a5aa77011cff5cdbf4e171fb1b56448b79a
parent2a36a0a06763416ad67be9ffdec0f19b1cc5a92e (diff)
downloadrtmux-fce30422f35865c0a5a24f63dde604329f12792e.tar.gz
rtmux-fce30422f35865c0a5a24f63dde604329f12792e.tar.bz2
rtmux-fce30422f35865c0a5a24f63dde604329f12792e.zip
Sync OpenBSD patchset 1136:
Add a couple of NULL pointer checks to key binding functions, from jspenguin on SF bug 3535531.
-rw-r--r--key-bindings.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/key-bindings.c b/key-bindings.c
index 8df6046c..b80728b9 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -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;