From e10325a729d39b32dcf83de17a7f19e5152ec496 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 22 Oct 2020 23:14:22 +0200 Subject: [PATCH] ERC: Fix ERC's IBuffer format "crash" on killed server buffer * lisp/erc/erc-ibuffer.el (erc-server-name): Fix a crash when displaying (or updating) an IBuffer buffer using ERC's first IBuffer format. This happens when one ERC buffer has its associated server buffer killed, e.g., voluntarily or automatically after server disconnection when `erc-kill-server-buffer-on-quit' is set to t. The culprit is the "Server" column, which returns nil in this case. Display "(closed)" instead. --- ChangeLog.3 | 13 +++++++++++++ lisp/erc/erc-ibuffer.el | 12 ++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog.3 b/ChangeLog.3 index ec2d3f8d46..65c846a307 100644 --- a/ChangeLog.3 +++ b/ChangeLog.3 @@ -1,3 +1,16 @@ +2020-10-22 Olivier Certner + + ERC: Fix ERC's IBuffer format "crash" on killed server buffer + + * lisp/erc/erc-ibuffer.el (erc-server-name): Fix a crash when + displaying (or updating) an IBuffer buffer using ERC's first + IBuffer format. This happens when one ERC buffer has its + associated server buffer killed, e.g., voluntarily or + automatically after server disconnection when + `erc-kill-server-buffer-on-quit' is set to t. The culprit is the + "Server" column, which returns nil in this case. Display + "(closed)" instead. + 2020-08-03 Phil Sainty lisp/so-long.el: Improve support for major mode hooks diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el index 7aee7705ff..556a25e3e7 100644 --- a/lisp/erc/erc-ibuffer.el +++ b/lisp/erc/erc-ibuffer.el @@ -92,10 +92,14 @@ " ")) (define-ibuffer-column erc-server-name (:name "Server") - (if (and erc-server-process (processp erc-server-process)) - (with-current-buffer (process-buffer erc-server-process) - (or erc-server-announced-name erc-session-server)) - "")) + (or + (when (and erc-server-process (processp erc-server-process)) + (let ((buffer (process-buffer erc-server-process))) + (if (buffer-live-p buffer) + (with-current-buffer buffer + (or erc-server-announced-name erc-session-server)) + "(closed)"))) + "")) (define-ibuffer-column erc-target (:name "Target") (if (eq major-mode 'erc-mode) -- 2.24.1