unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nick Gasson <nick@nickg.me.uk>
To: 49770@debbugs.gnu.org
Cc: Nick Gasson <nick@nickg.me.uk>
Subject: bug#49770: [PATCH] rmailsum: error when message contains no From header
Date: Thu, 29 Jul 2021 21:24:13 +0800	[thread overview]
Message-ID: <20210729132413.42158-1-nick@nickg.me.uk> (raw)

If you open a mbox file in rmail-mode containing a message without a
"From" header and press "h" to display the summary, the following
error occurs:

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    string-match("\n" nil)
    rmail-header-summary()
    rmail-create-summary(1 nil nil 101)
    rmail-create-summary-line(1)
    rmail-get-summary(1)
    rmail-new-summary-1("All" (rmail-summary) nil nil)
    rmail-new-summary("All" (rmail-summary) nil)
    rmail-summary()
    funcall-interactively(rmail-summary)
    call-interactively(rmail-summary nil nil)

* lisp/mail/rmailsum.el (rmail-header-summary): Check if from header
is set before scanning it for newlines.
---
 lisp/mail/rmailsum.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index 44cff21b0628..436bc78250cb 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -758,7 +758,7 @@ rmail-header-summary
 		    len mch lo newline)
                ;; If there are multiple lines in FROM,
                ;; discard up to the last newline in it.
-               (while (setq newline (string-match "\n" from))
+               (while (and from (setq newline (string-match "\n" from)))
                  (setq from (substring from (1+ newline))))
 	       (if (or (null from)
 		       (string-match
-- 
2.30.2






             reply	other threads:[~2021-07-29 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29 13:24 Nick Gasson [this message]
2021-07-29 15:41 ` bug#49770: [PATCH] rmailsum: error when message contains no From header Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210729132413.42158-1-nick@nickg.me.uk \
    --to=nick@nickg.me.uk \
    --cc=49770@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).