]> code.delx.au - gnu-emacs/commitdiff
Make `R' in eww work more reliably
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 5 May 2016 17:41:11 +0000 (19:41 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 5 May 2016 17:41:21 +0000 (19:41 +0200)
* lisp/net/eww.el (eww-score-readability): Protect against
null children.

lisp/net/eww.el

index 34cb02c24ac16851796f62f3834f6c07c03d0e66..6a8400320c215247b3f9b45dd8fa1f06a47b8370 100644 (file)
@@ -669,11 +669,13 @@ the like."
       (setq score (- (length (split-string (dom-text node))))))
      (t
       (dolist (elem (dom-children node))
-       (if (stringp elem)
-           (setq score (+ score (length (split-string elem))))
+       (cond
+         ((stringp elem)
+          (setq score (+ score (length (split-string elem)))))
+         ((consp elem)
          (setq score (+ score
                         (or (cdr (assoc :eww-readability-score (cdr elem)))
-                            (eww-score-readability elem))))))))
+                            (eww-score-readability elem)))))))))
     ;; Cache the score of the node to avoid recomputing all the time.
     (dom-set-attribute node :eww-readability-score score)
     score))