ui: fix panic in header formatter

Reported-by: noex
Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Moritz Poldrack 2022-04-01 13:39:15 +02:00 committed by Robin Jarry
parent 1aa32bf377
commit 7fe7fe4ea8
1 changed files with 4 additions and 0 deletions

View File

@ -130,6 +130,10 @@ func NewMessageViewer(acct *AccountView,
} }
func fmtHeader(msg *models.MessageInfo, header string, timefmt string) string { func fmtHeader(msg *models.MessageInfo, header string, timefmt string) string {
if msg == nil || msg.Envelope == nil {
return "error: no envelope for this message"
}
switch header { switch header {
case "From": case "From":
return format.FormatAddresses(msg.Envelope.From) return format.FormatAddresses(msg.Envelope.From)