changeset 98324:8b4f705fb54e

(rfc822-addresses): Prevent rfc822-bad-address from raising a wrong-type-argument error.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 24 Sep 2008 17:56:13 +0000
parents 882dea66012f
children a15398006f0d
files lisp/mail/rfc822.el
diffstat 1 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rfc822.el	Wed Sep 24 17:55:57 2008 +0000
+++ b/lisp/mail/rfc822.el	Wed Sep 24 17:56:13 2008 +0000
@@ -292,12 +292,15 @@
 	  (goto-char (point-min))
 	  (let ((list ())
 		tem
-		rfc822-address-start); this is for rfc822-bad-address
-	    (rfc822-nuke-whitespace)
-	    (while (not (eobp))
-	      (setq rfc822-address-start (point))
-	      (setq tem
-		    (catch 'address ; this is for rfc822-bad-address
+		;; This is for rfc822-bad-address.  Give it a non-nil
+		;; initial value to prevent rfc822-bad-address from
+		;; raising a wrong-type-argument error
+		(rfc822-address-start (point)))
+	    (catch 'address ; this is for rfc822-bad-address
+	      (rfc822-nuke-whitespace)
+	      (while (not (eobp))
+		(setq rfc822-address-start (point))
+		(setq tem
 		      (cond ((rfc822-looking-at ?\,)
 			     nil)
 			    ((looking-at "[][\000-\037@;:\\.>)]")
@@ -306,14 +309,14 @@
 			       (format "Strange character \\%c found"
 				       (preceding-char))))
 			    (t
-			     (rfc822-addresses-1 t)))))
-	      (cond ((null tem))
-		    ((stringp tem)
-		     (setq list (cons tem list)))
-		    (t
-		     (setq list (nconc (nreverse tem) list)))))
-	    (nreverse list)))
-      (and buf (kill-buffer buf))))))
+			     (rfc822-addresses-1 t))))
+		(cond ((null tem))
+		      ((stringp tem)
+		       (setq list (cons tem list)))
+		      (t
+		       (setq list (nconc (nreverse tem) list)))))
+	      (nreverse list))))
+	(and buf (kill-buffer buf))))))
 
 (provide 'rfc822)