aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jeffery <dev@jeffas.io>2020-07-01 22:57:01 +0100
committerReto Brunner <reto@labrat.space>2020-07-02 09:12:37 +0200
commitbf16ccde484ce3b6d2a4b843e7ebc04a9b2a957d (patch)
tree9dbfe57e6088840d906a6f1ec75a22d4b6ea2c43
parent8f1c6c46ff1de2d94377c0cf20fdc8bbdba59fef (diff)
downloadaerc-bf16ccde484ce3b6d2a4b843e7ebc04a9b2a957d.tar.gz
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.
-rw-r--r--widgets/msglist.go10
1 files 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,