summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-06-25 14:31:23 +0200
committerMichael Albinus <michael.albinus@gmx.de>2023-06-25 14:31:23 +0200
commitfc7e7c3fde37d2038b75b2e8c27cfbbd616c85fb (patch)
tree521064d932b01c3ce1c02b9499cc003c8b9a7489 /lisp
parent2aa57fe6cf973c4e7c5134958a17a478a6feb4a9 (diff)
downloademacs-fc7e7c3fde37d2038b75b2e8c27cfbbd616c85fb.tar.gz
emacs-fc7e7c3fde37d2038b75b2e8c27cfbbd616c85fb.tar.bz2
emacs-fc7e7c3fde37d2038b75b2e8c27cfbbd616c85fb.zip
Fix type check in tramp-get-buffer-string
* lisp/net/tramp.el (tramp-get-buffer-string): Check, that BUFFER is really a bufferp.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/tramp.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b46eeb8e374..20678ec8d1a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1960,8 +1960,11 @@ version, the function does nothing."
"Return contents of BUFFER.
If BUFFER is not a buffer or a buffer name, return the contents
of `current-buffer'."
- (with-current-buffer (or buffer (current-buffer))
- (substring-no-properties (buffer-string))))
+ (or (let ((buf (or buffer (current-buffer))))
+ (when (bufferp buf)
+ (with-current-buffer (or buffer (current-buffer))
+ (substring-no-properties (buffer-string)))))
+ ""))
(defun tramp-debug-buffer-name (vec)
"A name for the debug buffer for VEC."