From 6f9ff3d7493d144af182ddd6fcf512f98b78ad0c Mon Sep 17 00:00:00 2001 From: Sergey Organov Date: Thu, 22 Jul 2021 14:22:26 +0200 Subject: [PATCH] Avoid failing in desktop-clear due to killed buffers * lisp/desktop.el (desktop-clear): check that buffer is not already killed before attempting to kill it. A buffer might become killed as part of regular operation as a side-effect of killing another buffer, and then attempt to kill it again causes error (bug#49692). Copyright-paperwork-exempt: yes --- lisp/desktop.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/desktop.el b/lisp/desktop.el index b9467c87527..3b257132163 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -706,8 +706,9 @@ if different)." "\\)\\'"))) (dolist (buffer (buffer-list)) (let ((bufname (buffer-name buffer))) - (unless (or (eq (aref bufname 0) ?\s) ;; Don't kill internal buffers - (string-match-p preserve-regexp bufname)) + (unless (or (null bufname) + (eq (aref bufname 0) ?\s) ;; Don't kill internal buffers + (string-match-p preserve-regexp bufname)) (kill-buffer buffer))))) (delete-other-windows) (when (and desktop-restore-frames -- 2.39.2