From 1a29adc25799d3ab210527252be7e3c496373925 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sun, 5 Jan 2014 10:45:45 +0100 Subject: [PATCH] * net/shr.el (shr-descend): Don't bug out if the anchor is empty. Fixes: debbugs:16285 --- lisp/ChangeLog | 5 +++++ lisp/net/shr.el | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8ea2498c246..86064cecf98 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-01-05 Lars Magne Ingebrigtsen + + * net/shr.el (shr-descend): Don't bug out if the anchor is empty + (bug#16285). + 2014-01-05 Kenjiro NAKAYAMA * net/eww.el (eww): Support single/double quote for search. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 4dc3bb24812..77ebf474bc1 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -380,6 +380,10 @@ size, and full-buffer size." (shr-generic (cdr dom))) (when (and shr-target-id (equal (cdr (assq :id (cdr dom))) shr-target-id)) + ;; If the element was empty, we don't have anything to put the + ;; anchor on. So just insert a dummy character. + (when (= start (point)) + (insert "*")) (put-text-property start (1+ start) 'shr-target-id shr-target-id)) ;; If style is set, then this node has set the color. (when style -- 2.39.2