From 747da13f44ef895e51081065546f3c465637a615 Mon Sep 17 00:00:00 2001 From: Ayaan <138162656+def3r@users.noreply.github.com> Date: Mon, 16 Mar 2026 03:11:05 +0530 Subject: [PATCH] fix(terminal): check `buf` before deleting extmark #38314 Problem: buffer could be null when trying to delete "[Process exited]" extmark Solution: delete extmark only if buffer exists --- src/nvim/terminal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 4b168e3596..be77e6d70f 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -680,7 +680,9 @@ void terminal_close(Terminal **termpp, int status) // only need to call the close callback to clean up the terminal object. only_destroy = true; // Buffer may be reused so delete the "[Process exited]" msg - extmark_del_id(buf, (uint32_t)-1, term->exitmsg_id); + if (buf) { + extmark_del_id(buf, (uint32_t)-1, term->exitmsg_id); + } } else { // flush any pending changes to the buffer if (!exiting) {