Subject: Path to fix bug in function erc-kill-query-buffers

From: Francis Litterio <[email-masked]>
Date: Sun, 6 Dec 2015 01:13:57 +0000 (UTC)

In the latest Emacs sources (Git branch "master"), function
erc-kill-query-buffers fails to protect against being passed nil
for argument PROCESS, which causes all channel buffers on all
servers to be deleted!  This can happen if command /QUIT is issued
in a disconnected server buffer and variable erc-kill-queries-on-quit
is non-nil.

This patch fixes this problem.
--
Fran
flitterio <at> gmail.com

--- erc.el~	2015-08-09 16:04:46.097043200 -0400
+++ erc.el	2015-08-09 16:07:19.082925200 -0400
@@ -6071,13 +6071,14 @@
   (or (file-accessible-directory-p dir) (error "Cannot access %s" dir)))
 
 (defun erc-kill-query-buffers (process)
-  "Kill all buffers of PROCESS."
+  "Kill all buffers of PROCESS.  Does nothing if PROCESS is not a process
object."
   ;; here, we only want to match the channel buffers, to avoid
   ;; "selecting killed buffers" b0rkage.
-  (erc-with-all-buffers-of-server process
-    (lambda ()
-      (not (erc-server-buffer-p)))
-    (kill-buffer (current-buffer))))
+  (if (processp process)
+      (erc-with-all-buffers-of-server process
+        (lambda ()
+          (not (erc-server-buffer-p)))
+        (kill-buffer (current-buffer))))
 
 (defun erc-nick-at-point ()
   "Give information about the nickname at `point'.