aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatsumi Yamaoka2010-11-17 08:28:15 +0000
committerKatsumi Yamaoka2010-11-17 08:28:15 +0000
commitf8d8a97bda1c83380f3f688c4ba0b7fa16320c83 (patch)
tree65f4034585cff96dcf4c7015daea466b97442d02
parent40de2c6dd32a746e3d31492a0f43a290e9ef5d1d (diff)
downloademacs-f8d8a97bda1c83380f3f688c4ba0b7fa16320c83.tar.gz
emacs-f8d8a97bda1c83380f3f688c4ba0b7fa16320c83.zip
shr.el (shr-image-displayer): Protect function against non-existent image source.
-rw-r--r--lisp/gnus/ChangeLog3
-rw-r--r--lisp/gnus/shr.el27
2 files changed, 17 insertions, 13 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 7d3b2d06835..b509bc39c76 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,5 +1,8 @@
12010-11-17 Katsumi Yamaoka <yamaoka@jpl.org> 12010-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
2 2
3 * shr.el (shr-image-displayer): Protect function against non-existent
4 image source.
5
3 * gnus-art.el (gnus-inhibit-images): New user option. 6 * gnus-art.el (gnus-inhibit-images): New user option.
4 (gnus-mime-display-single): Don't display image if it is non-nil. 7 (gnus-mime-display-single): Don't display image if it is non-nil.
5 8
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index 2dd33ecbc13..526f8121891 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -441,19 +441,20 @@ CONTENT-FUNCTION is a function to retrieve an image for a cid url that
441is an argument. The function to be returned takes three arguments URL, 441is an argument. The function to be returned takes three arguments URL,
442START, and END." 442START, and END."
443 `(lambda (url start end) 443 `(lambda (url start end)
444 (if (string-match "\\`cid:" url) 444 (when url
445 ,(when content-function 445 (if (string-match "\\`cid:" url)
446 `(let ((image (funcall ,content-function 446 ,(when content-function
447 (substring url (match-end 0))))) 447 `(let ((image (funcall ,content-function
448 (when image 448 (substring url (match-end 0)))))
449 (goto-char start) 449 (when image
450 (shr-put-image image 450 (goto-char start)
451 (prog1 451 (shr-put-image image
452 (buffer-substring-no-properties start end) 452 (prog1
453 (delete-region start end)))))) 453 (buffer-substring-no-properties start end)
454 (url-retrieve url 'shr-image-fetched 454 (delete-region start end))))))
455 (list (current-buffer) start end) 455 (url-retrieve url 'shr-image-fetched
456 t)))) 456 (list (current-buffer) start end)
457 t)))))
457 458
458(defun shr-heading (cont &rest types) 459(defun shr-heading (cont &rest types)
459 (shr-ensure-paragraph) 460 (shr-ensure-paragraph)