From: Lars Magne Ingebrigtsen Date: Mon, 15 Dec 2014 05:05:05 +0000 (+0100) Subject: * net/shr.el (shr-fold-text): Don't bug out on zero-length text. X-Git-Tag: emacs-25.0.90~2635^2~65^2~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=872617ad730906f9437b90c3b90af2e2458f00f6;p=emacs.git * net/shr.el (shr-fold-text): Don't bug out on zero-length text. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8a0d5181bae..364511c2c15 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2014-12-15 Lars Magne Ingebrigtsen + + * net/shr.el (shr-fold-text): Don't bug out on zero-length text. + 2014-12-14 Alan Mackenzie * lisp/cus-start.el (all): Add fast-but-imprecise-scrolling. diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 6e06a76bf2a..387bb024a52 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -414,13 +414,15 @@ size, and full-buffer size." (cdr (assq 'background-color shr-stylesheet)))))))) (defun shr-fold-text (text) - (with-temp-buffer - (let ((shr-indentation 0) - (shr-state nil) - (shr-start nil) - (shr-internal-width (window-width))) - (shr-insert text) - (buffer-string)))) + (if (zerop (length text)) + text + (with-temp-buffer + (let ((shr-indentation 0) + (shr-state nil) + (shr-start nil) + (shr-internal-width (window-width))) + (shr-insert text) + (buffer-string))))) (define-inline shr-char-breakable-p (char) "Return non-nil if a line can be broken before and after CHAR."