From bf16ccde484ce3b6d2a4b843e7ebc04a9b2a957d Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Wed, 1 Jul 2020 22:57:01 +0100 Subject: Fix nil pointer deref on Envelope The Envelope was nil but being deref'ed for the Subject. This was experienced when switching tabs on IMAP. --- widgets/msglist.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/widgets/msglist.go b/widgets/msglist.go index 626f4c97..1ed6bb15 100644 --- a/widgets/msglist.go +++ b/widgets/msglist.go @@ -123,11 +123,15 @@ func (ml *MessageList) Draw(ctx *ui.Context) { } ctx.Fill(0, row, textWidth, 1, ' ', style) - uiConfig := ml.conf.GetUiConfig(map[config.ContextType]string{ + + confParams := map[config.ContextType]string{ config.UI_CONTEXT_ACCOUNT: ml.aerc.SelectedAccount().AccountConfig().Name, config.UI_CONTEXT_FOLDER: ml.aerc.SelectedAccount().Directories().Selected(), - config.UI_CONTEXT_SUBJECT: msg.Envelope.Subject, - }) + } + if msg.Envelope != nil { + confParams[config.UI_CONTEXT_SUBJECT] = msg.Envelope.Subject + } + uiConfig := ml.conf.GetUiConfig(confParams) fmtStr, args, err := format.ParseMessageFormat( ml.aerc.SelectedAccount().acct.From, -- cgit