From 42f0e3ef12a885e1fdf465af0547d93df692b4bc Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Wed, 29 Apr 2026 09:33:44 +0200 Subject: Guard Sixel cleanup against nil files kitty-gfx--sixel-cleanup can be called without a file when cleanup is routed through generic backend code. In that case the old implementation passed nil to md5 while pruning cached Sixel temp files. Make the cleanup a no-op when FILE is nil. --- kitty-graphics.el | 15 ++++++++------- 1 file 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. -- cgit v1.3.1