]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't bug out in src when there's no srcset
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 23 Jul 2022 05:46:52 +0000 (07:46 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 23 Jul 2022 05:46:52 +0000 (07:46 +0200)
* lisp/net/shr.el (shr--preferred-image): Don't bug out when
there's no srcset.

lisp/net/shr.el

index 52e4389954ab7aaf743a4a85f001901092ae3632..248faeb223c057630c128607f3cf13e9624e3730 100644 (file)
@@ -1740,13 +1740,14 @@ BASE is the URL of the HTML being rendered."
     shr-cookie-policy)))
 
 (defun shr--preferred-image (dom)
-  (let* ((srcset (shr--parse-srcset (dom-attr dom 'srcset)
-                                    (and (dom-attr dom 'width)
-                                         (string-to-number
-                                          (dom-attr dom 'width)))))
+  (let* ((srcset (and (dom-attr dom 'srcset)
+                      (shr--parse-srcset (dom-attr dom 'srcset)
+                                         (and (dom-attr dom 'width)
+                                              (string-to-number
+                                               (dom-attr dom 'width))))))
          (frame-width (frame-pixel-width))
          candidate)
-    (when (length> srcset 0)
+    (when srcset
       ;; Choose the smallest picture that's bigger than the current
       ;; frame.
       (setq candidate (caar srcset))