unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49770: [PATCH] rmailsum: error when message contains no From header
@ 2021-07-29 13:24 Nick Gasson
  2021-07-29 15:41 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Gasson @ 2021-07-29 13:24 UTC (permalink / raw)
  To: 49770; +Cc: Nick Gasson

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






^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#49770: [PATCH] rmailsum: error when message contains no From header
  2021-07-29 13:24 bug#49770: [PATCH] rmailsum: error when message contains no From header Nick Gasson
@ 2021-07-29 15:41 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2021-07-29 15:41 UTC (permalink / raw)
  To: Nick Gasson; +Cc: 49770-done

> From: Nick Gasson <nick@nickg.me.uk>
> Date: Thu, 29 Jul 2021 21:24:13 +0800
> Cc: Nick Gasson <nick@nickg.me.uk>
> 
> 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.

Thanks, installed (with a tiny change: I prefer an explicit 'stringp'
test where we must have a string).

This contribution was small enough for us to be able to receive it
without a copyright assignment, but if you'd like to be able to
contribute in the future without restrictions, I suggest to start your
copyright assignment paperwork rolling.  If you'd like that, I will
send you the form to fill and the instructions to go with it.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-29 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-29 13:24 bug#49770: [PATCH] rmailsum: error when message contains no From header Nick Gasson
2021-07-29 15:41 ` Eli Zaretskii

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).