From 27ae6ca789e70f7a612f96cceebc56fe7d15f99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 13 Mar 2026 23:11:00 +0100 Subject: [PATCH] core: fix crash with /eval when the current buffer is closed in a command --- CHANGELOG.md | 1 + src/core/core-command.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 249ea36d7..fc59b77dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ SPDX-License-Identifier: GPL-3.0-or-later ### Fixed +- core: fix crash with /eval when the current buffer is closed in a command - core: fix buffer size in function util_parse_time, causing buffer overflow error in unit tests - irc: fix unit of server option `anti_flood` from seconds to milliseconds in output of `/server listfull` - irc: fix creation of irc.msgbuffer option without a server name diff --git a/src/core/core-command.c b/src/core/core-command.c index f6bc67617..be92b7865 100644 --- a/src/core/core-command.c +++ b/src/core/core-command.c @@ -2469,6 +2469,16 @@ COMMAND_CALLBACK(eval) { for (ptr_command = commands; *ptr_command; ptr_command++) { + if (!gui_buffer_valid (buffer)) + { + buffer = gui_current_window->buffer; + if (pointers) + { + hashtable_set (pointers, "window", + gui_window_search_with_buffer (buffer)); + hashtable_set (pointers, "buffer", buffer); + } + } result = eval_expression (*ptr_command, pointers, NULL, options); if (result)