diff options
author | Eli Zaretskii <eliz@gnu.org> | 2024-01-06 13:26:29 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2024-01-06 13:26:29 +0200 |
commit | 466d1c98a9ef7490332469165f63a38c2b07a05d (patch) | |
tree | d1b7bdce548a0a9a26c1b79520bf85ac72a2eb0f /lisp/emacs-lisp | |
parent | 2a861124e89d7a29b19bb9a6f22e962c37444212 (diff) | |
download | emacs-466d1c98a9ef7490332469165f63a38c2b07a05d.tar.gz emacs-466d1c98a9ef7490332469165f63a38c2b07a05d.tar.bz2 emacs-466d1c98a9ef7490332469165f63a38c2b07a05d.zip |
Fix icons.el when icon does not exist as a file
* lisp/emacs-lisp/icons.el (icons--create): Handle the case when
ICON is a file that doesn't exists or is unreadable. Suggested by
David Ponce <da_vid@orange.fr>. (Bug#66846)
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/icons.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el index a35a00ec1f3..1fc0e39f9fe 100644 --- a/lisp/emacs-lisp/icons.el +++ b/lisp/emacs-lisp/icons.el @@ -187,11 +187,13 @@ present if the icon is represented by an image." merged) (cl-defmethod icons--create ((_type (eql 'image)) icon keywords) - (let ((file (if (file-name-absolute-p icon) - icon - (and (fboundp 'image-search-load-path) - (image-search-load-path icon))))) - (and (display-images-p) + (let* ((file (if (file-name-absolute-p icon) + icon + (and (fboundp 'image-search-load-path) + (image-search-load-path icon)))) + (file-exists (and (stringp file) (file-readable-p file)))) + (and file-exists + (display-images-p) (fboundp 'image-supported-file-p) (image-supported-file-p file) (propertize |