summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2018-03-29 08:03:51 +0000
committernicm <nicm@openbsd.org>2018-03-29 08:03:51 +0000
commita8b654cb81e94e67f948c9102bee658256e0a1c5 (patch)
tree816edb4c36530ec010db1c887c76d44a3a0b6a78
parentNET_LOCK is also required in pppxwrite and pppxclose. (diff)
downloadwireguard-openbsd-a8b654cb81e94e67f948c9102bee658256e0a1c5.tar.xz
wireguard-openbsd-a8b654cb81e94e67f948c9102bee658256e0a1c5.zip
Do not crash on empty window, reported by Jamie Macdonald in GitHub
issue 1299. Patch from Thomas Adam.
-rw-r--r--usr.bin/tmux/window-tree.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c
index 2dddb0a99a5..8e7e217fd03 100644
--- a/usr.bin/tmux/window-tree.c
+++ b/usr.bin/tmux/window-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-tree.c,v 1.28 2018/02/28 08:55:44 nicm Exp $ */
+/* $OpenBSD: window-tree.c,v 1.29 2018/03/29 08:03:51 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -296,7 +296,8 @@ window_tree_build_window(struct session *s, struct winlink *wl, void* modedata,
free(text);
free(name);
- wp = TAILQ_FIRST(&wl->window->panes);
+ if ((wp = TAILQ_FIRST(&wl->window->panes)) == NULL)
+ goto empty;
if (TAILQ_NEXT(wp, entry) == NULL) {
if (!window_tree_filter_pane(s, wl, wp, filter))
goto empty;