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.
This commit is contained in:
Andrew Jeffery 2020-07-01 22:57:01 +01:00 committed by Reto Brunner
parent 8f1c6c46ff
commit bf16ccde48
1 changed files with 7 additions and 3 deletions

View File

@ -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,