summaryrefslogtreecommitdiff
path: root/kitty-graphics.el
diff options
context:
space:
mode:
Diffstat (limited to 'kitty-graphics.el')
-rw-r--r--kitty-graphics.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/kitty-graphics.el b/kitty-graphics.el
index d1514df..5eed0c1 100644
--- a/kitty-graphics.el
+++ b/kitty-graphics.el
@@ -860,13 +860,14 @@ Sixel has no placement IDs — erase by writing spaces over the region."
(defun kitty-gfx--sixel-cleanup (file _image-id)
"Cleanup Sixel resources for FILE."
- (remhash file kitty-gfx--sixel-cache)
- ;; Remove cached sixel encodings for this file
- (dolist (temp-file kitty-gfx--sixel-temp-files)
- (when (string-match-p (regexp-quote (md5 file)) temp-file)
- (kitty-gfx--log "sixel-cleanup: deleting %s" temp-file)
- (ignore-errors (delete-file temp-file))
- (setq kitty-gfx--sixel-temp-files (delete temp-file kitty-gfx--sixel-temp-files)))))
+ (when file
+ (remhash file kitty-gfx--sixel-cache)
+ ;; Remove cached sixel encodings for this file
+ (dolist (temp-file kitty-gfx--sixel-temp-files)
+ (when (string-match-p (regexp-quote (md5 file)) temp-file)
+ (kitty-gfx--log "sixel-cleanup: deleting %s" temp-file)
+ (ignore-errors (delete-file temp-file))
+ (setq kitty-gfx--sixel-temp-files (delete temp-file kitty-gfx--sixel-temp-files))))))
(defun kitty-gfx--sixel-cleanup-all ()
"Cleanup all Sixel resources.