mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-18 03:40:47 -08:00
Don't bug out in src when there's no srcset
* lisp/net/shr.el (shr--preferred-image): Don't bug out when there's no srcset.
This commit is contained in:
parent
2ebede7d75
commit
e00f882905
1 changed files with 6 additions and 5 deletions
|
|
@ -1740,13 +1740,14 @@ BASE is the URL of the HTML being rendered."
|
||||||
shr-cookie-policy)))
|
shr-cookie-policy)))
|
||||||
|
|
||||||
(defun shr--preferred-image (dom)
|
(defun shr--preferred-image (dom)
|
||||||
(let* ((srcset (shr--parse-srcset (dom-attr dom 'srcset)
|
(let* ((srcset (and (dom-attr dom 'srcset)
|
||||||
|
(shr--parse-srcset (dom-attr dom 'srcset)
|
||||||
(and (dom-attr dom 'width)
|
(and (dom-attr dom 'width)
|
||||||
(string-to-number
|
(string-to-number
|
||||||
(dom-attr dom 'width)))))
|
(dom-attr dom 'width))))))
|
||||||
(frame-width (frame-pixel-width))
|
(frame-width (frame-pixel-width))
|
||||||
candidate)
|
candidate)
|
||||||
(when (length> srcset 0)
|
(when srcset
|
||||||
;; Choose the smallest picture that's bigger than the current
|
;; Choose the smallest picture that's bigger than the current
|
||||||
;; frame.
|
;; frame.
|
||||||
(setq candidate (caar srcset))
|
(setq candidate (caar srcset))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue