From 12d9150ead2f3393cfa242b173a46bd8b4a3ae9e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 11 Aug 2010 07:41:06 +0000 Subject: Handle failure to change mode, to avoid dying when switching into copy mode when already in a different mode. Reported by "Florian". --- usr.bin/tmux/cmd-copy-mode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c index 742c46fd3a0..93fe93aaa9b 100644 --- a/usr.bin/tmux/cmd-copy-mode.c +++ b/usr.bin/tmux/cmd-copy-mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-copy-mode.c,v 1.10 2010/04/06 21:35:44 nicm Exp $ */ +/* $OpenBSD: cmd-copy-mode.c,v 1.11 2010/08/11 07:41:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -62,7 +62,8 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx) if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL) return (-1); - window_pane_set_mode(wp, &window_copy_mode); + if (window_pane_set_mode(wp, &window_copy_mode) != 0) + return (0); window_copy_init_from_pane(wp); if (wp->mode == &window_copy_mode && cmd_check_flag(data->chflags, 'u')) window_copy_pageup(wp); -- cgit v1.2.3