]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/shr.el (shr-fold-text): Don't bug out on zero-length text.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 15 Dec 2014 05:05:05 +0000 (06:05 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 15 Dec 2014 05:05:05 +0000 (06:05 +0100)
lisp/ChangeLog
lisp/net/shr.el

index 8a0d5181bae183916a24e7818bc61c06a9fb397b..364511c2c15f89d2028c917d47f41a1118178f3a 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-15  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * net/shr.el (shr-fold-text): Don't bug out on zero-length text.
+
 2014-12-14  Alan Mackenzie  <acm@muc.de>
 
        * lisp/cus-start.el (all): Add fast-but-imprecise-scrolling.
index 6e06a76bf2a75eb2819c5d644f3ffae9b2602799..387bb024a528aef906277e101e9dc48cb02d9181 100644 (file)
@@ -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."