1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-07 15:21:46 +00:00

* lisp/net/tramp.el (tramp-handle-file-modes): Check for nil file-attributes.

This commit is contained in:
Michael Albinus 2019-09-21 09:53:18 +02:00
parent 0dd4b87e61
commit 8f5da5587f

View File

@ -3152,10 +3152,10 @@ User is always nil."
(defun tramp-handle-file-modes (filename)
"Like `file-modes' for Tramp files."
(let ((truename (or (file-truename filename) filename)))
(when (file-exists-p truename)
(tramp-mode-string-to-int
(tramp-compat-file-attribute-modes (file-attributes truename))))))
;; Starting with Emacs 25.1, `when-let' can be used.
(let ((attrs (file-attributes (or (file-truename filename) filename))))
(when attrs
(tramp-mode-string-to-int (tramp-compat-file-attribute-modes attrs)))))
;; Localname manipulation functions that grok Tramp localnames...
(defun tramp-handle-file-name-as-directory (file)