summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2023-08-11 17:09:01 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2023-08-11 17:09:01 +0000
commitda4b3292795813240c48340d1186551bdb3c6258 (patch)
treefb0a24d8906d0f2d8bc6dc276a896f118390619b
parent5b159fd3a2139a6ab07bd4d8f3ec32b68f20296a (diff)
Do not crash if in buffer mode and the last buffer is deleted using the
command.
-rw-r--r--usr.bin/tmux/mode-tree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c
index 08a5c294f5f..7951cc8d0df 100644
--- a/usr.bin/tmux/mode-tree.c
+++ b/usr.bin/tmux/mode-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-tree.c,v 1.64 2023/08/08 08:08:47 nicm Exp $ */
+/* $OpenBSD: mode-tree.c,v 1.65 2023/08/11 17:09:00 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -497,7 +497,7 @@ mode_tree_build(struct mode_tree_data *mtd)
mode_tree_clear_lines(mtd);
mode_tree_build_lines(mtd, &mtd->children, 0);
- if (tag == UINT64_MAX)
+ if (mtd->line_list != NULL && tag == UINT64_MAX)
tag = mtd->line_list[mtd->current].item->tag;
mode_tree_set_current(mtd, tag);