From 8fccbbb02673bed71676412f1a313093a39c48ff Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 6 Dec 2021 10:08:42 +0000 Subject: [PATCH] Do not dereference NULL window when resizing client, GitHub issue 2982. --- resize.c | 2 ++ tty.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/resize.c b/resize.c index 8416ad6a..175dd740 100644 --- a/resize.c +++ b/resize.c @@ -348,6 +348,8 @@ recalculate_size_skip_client(struct client *loop, __unused int type, * is not the current window - this is used for aggressive-resize. * Otherwise skip any session that doesn't contain the window. */ + if (loop->session->curw == NULL) + return (1); if (current) return (loop->session->curw->window != w); return (session_has(loop->session, w) == 0); diff --git a/tty.c b/tty.c index 233d52a8..a9678eaf 100644 --- a/tty.c +++ b/tty.c @@ -937,7 +937,9 @@ tty_update_window_offset(struct window *w) struct client *c; TAILQ_FOREACH(c, &clients, entry) { - if (c->session != NULL && c->session->curw->window == w) + if (c->session != NULL && + c->session->curw != NULL && + c->session->curw->window == w) tty_update_client_offset(c); } }