My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nomicon/pkgs/applications/editors/emacs/elisp-packages/ement/handle-nil-images.patch

29 lines
1.2 KiB

diff --git a/ement.el b/ement.el
index c9596a7..1b33045 100644
--- a/ement.el
+++ b/ement.el
@@ -682,14 +682,15 @@ can cause undesirable underlining."
"Return a copy of IMAGE set to MAX-WIDTH and MAX-HEIGHT.
IMAGE should be one as created by, e.g. `create-image'."
;; It would be nice if the image library had some simple functions to do this sort of thing.
- (let ((new-image (cl-copy-list image)))
- (when (fboundp 'imagemagick-types)
- ;; Only do this when ImageMagick is supported.
- ;; FIXME: When requiring Emacs 27+, remove this (I guess?).
- (setf (image-property new-image :type) 'imagemagick))
- (setf (image-property new-image :max-width) max-width
- (image-property new-image :max-height) max-height)
- new-image))
+ (when image
+ (let ((new-image (cl-copy-list image)))
+ (when (fboundp 'imagemagick-types)
+ ;; Only do this when ImageMagick is supported.
+ ;; FIXME: When requiring Emacs 27+, remove this (I guess?).
+ (setf (image-property new-image :type) 'imagemagick))
+ (setf (image-property new-image :max-width) max-width
+ (image-property new-image :max-height) max-height)
+ new-image)))
;;;;; Reading/writing sessions