diff options
| author | Victor J. Orlikowski | 2019-02-10 11:13:57 -0500 |
|---|---|---|
| committer | Eli Zaretskii | 2019-02-15 10:13:00 +0200 |
| commit | f721084f788dbbbf114c47f87af7d5771b5fb769 (patch) | |
| tree | 45191183e74683ecba8df735eec88929b976c88e | |
| parent | 3cba92d42ecf2156296b5f05c07a3d1ded78218e (diff) | |
| download | emacs-f721084f788dbbbf114c47f87af7d5771b5fb769.tar.gz emacs-f721084f788dbbbf114c47f87af7d5771b5fb769.zip | |
Avoid errors in erc-dcc.el when erc-dcc-verbose is non-nil
* lisp/erc/erc-dcc.el (erc-dcc-get-filter): Don't assume STR
is always a string. Use 'buffer-name' to get the DCC file
name, as buffer-file-name is not set in the process buffer.
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/erc/erc-dcc.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el index c530b26c05f..2b41c8c705b 100644 --- a/lisp/erc/erc-dcc.el +++ b/lisp/erc/erc-dcc.el | |||
| @@ -989,17 +989,20 @@ rather than every 1024 byte block, but nobody seems to care." | |||
| 989 | (let ((inhibit-read-only t) | 989 | (let ((inhibit-read-only t) |
| 990 | received-bytes) | 990 | received-bytes) |
| 991 | (goto-char (point-max)) | 991 | (goto-char (point-max)) |
| 992 | (insert (string-make-unibyte str)) | 992 | (if str |
| 993 | (insert (string-make-unibyte str))) | ||
| 993 | 994 | ||
| 994 | (when (> (point-max) erc-dcc-receive-cache) | 995 | (when (> (point-max) erc-dcc-receive-cache) |
| 995 | (erc-dcc-append-contents (current-buffer) erc-dcc-file-name)) | 996 | (erc-dcc-append-contents (current-buffer) erc-dcc-file-name)) |
| 996 | (setq received-bytes (+ (buffer-size) erc-dcc-byte-count)) | 997 | (setq received-bytes (buffer-size)) |
| 998 | (if erc-dcc-byte-count | ||
| 999 | (setq received-bytes (+ received-bytes erc-dcc-byte-count))) | ||
| 997 | 1000 | ||
| 998 | (and erc-dcc-verbose | 1001 | (and erc-dcc-verbose |
| 999 | (erc-display-message | 1002 | (erc-display-message |
| 1000 | nil 'notice erc-server-process | 1003 | nil 'notice erc-server-process |
| 1001 | 'dcc-get-bytes-received | 1004 | 'dcc-get-bytes-received |
| 1002 | ?f (file-name-nondirectory buffer-file-name) | 1005 | ?f (file-name-nondirectory (buffer-name)) |
| 1003 | ?b (number-to-string received-bytes))) | 1006 | ?b (number-to-string received-bytes))) |
| 1004 | (cond | 1007 | (cond |
| 1005 | ((and (> (plist-get erc-dcc-entry-data :size) 0) | 1008 | ((and (> (plist-get erc-dcc-entry-data :size) 0) |
| @@ -1007,7 +1010,7 @@ rather than every 1024 byte block, but nobody seems to care." | |||
| 1007 | (erc-display-message | 1010 | (erc-display-message |
| 1008 | nil '(notice error) 'active | 1011 | nil '(notice error) 'active |
| 1009 | 'dcc-get-file-too-long | 1012 | 'dcc-get-file-too-long |
| 1010 | ?f (file-name-nondirectory buffer-file-name)) | 1013 | ?f (file-name-nondirectory (buffer-name))) |
| 1011 | (delete-process proc)) | 1014 | (delete-process proc)) |
| 1012 | (t | 1015 | (t |
| 1013 | (process-send-string | 1016 | (process-send-string |