[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

sb-atom-hash: deal with empty content

Dear maintainers,

I just had sb-atom-hash throwing an error due to a malformed feed which
had an article with empty content (which leads to a call to
shimbun-decode-entities-string with 'nil' as argument). While atom-hash
is not really at fault here, I think it should still try to degrade
gracefully in such cases. Please consider applying the attached patch,
which circumvents this problem. With this patch, the article will still
appear, but will be marked as expired/canceled when selected.


2009-08-04  David Engster  <dengste@xxxxxx>

	* sb-atom-hash.el (content-hash-update-items-impl): Deal with
          missing content.

Index: sb-atom-hash.el
RCS file: /storage/cvsroot/emacs-w3m/shimbun/sb-atom-hash.el,v
retrieving revision 1.7
diff -u -r1.7 sb-atom-hash.el
--- sb-atom-hash.el	5 Apr 2009 11:56:05 -0000	1.7
+++ sb-atom-hash.el	4 Aug 2009 08:24:34 -0000
@@ -130,9 +130,11 @@
 			  (setq content (shimbun-rss-node-text
 					 atom-ns contentsym entry))
 			;; non-escaped, but  "<>& to &xxx;
-			(setq content (shimbun-decode-entities-string
-				       (shimbun-rss-node-text
-					    atom-ns contentsym entry))))))))
+			(let ((text (shimbun-rss-node-text
+				     atom-ns contentsym entry)))
+			  (when text
+			    (setq content (shimbun-decode-entities-string
+					   text)))))))))
 		(when (and id content)
 		  (content-hash-set-item content-hash id content))))))))))