diff --git a/ement-lib.el b/ement-lib.el index f0b2738..025a191 100644 --- a/ement-lib.el +++ b/ement-lib.el @@ -644,14 +644,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))) (defun ement--room-alias (room) "Return latest m.room.canonical_alias event in ROOM."