From 872617ad730906f9437b90c3b90af2e2458f00f6 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 15 Dec 2014 06:05:05 +0100 Subject: [PATCH] * net/shr.el (shr-fold-text): Don't bug out on zero-length text. --- lisp/ChangeLog | 4 ++++ lisp/net/shr.el | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) 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." -- 2.39.2