Return immediately if the list is empty in mode_tree_key instead of

crashing, from Bryce Miller in GitHub issue 5170.
This commit is contained in:
nicm
2026-06-08 15:16:21 +00:00
parent 529afada82
commit 85d72b9952

View File

@@ -1224,6 +1224,11 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
u_int i, x, y;
int choice, preview;
if (mtd->line_size == 0) {
*key = KEYC_NONE;
return (1);
}
if (KEYC_IS_MOUSE(*key) && m != NULL) {
if (cmd_mouse_at(mtd->wp, m, &x, &y, 0) != 0) {
*key = KEYC_NONE;