aboutsummaryrefslogtreecommitdiffstats
path: root/lib/messageview.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2021-10-28 14:59:54 +0200
committerRobin Jarry <robin@jarry.cc>2021-10-28 16:38:23 +0200
commit074b0a1bd8da38547c6e3eed9836149327012228 (patch)
tree0082759cd8b160c4e7513cb87a1bc600e9bb4f06 /lib/messageview.go
parentfc84b19bba0e0953ec06de27f1ec9c9f8d1a96ef (diff)
downloadaerc-074b0a1bd8da38547c6e3eed9836149327012228.tar.gz
view,list: fix crash when viewing incomplete imap messages
With IMAP, due to an unidentified reason, some messages to not have any body accessible. When viewing them, aerc crashes: git.sr.ht/~sircmpwn/aerc/lib.usePGP lib/messageview.go:37 git.sr.ht/~sircmpwn/aerc/lib.NewMessageStoreView lib/messageview.go:67 git.sr.ht/~sircmpwn/aerc/commands/account.ViewMessage.Execute commands/account/view.go:45 git.sr.ht/~sircmpwn/aerc/commands.(*Commands).ExecuteCommand commands/commands.go:66 main.execCommand aerc.go:61 main.main.func2 aerc.go:160 aerc crashed: runtime error: invalid memory address or nil pointer dereference Check the pointer before dereferencing. Also, add a global check in ParseMessageFormat where a similar issue may occur. Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/messageview.go')
-rw-r--r--lib/messageview.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/messageview.go b/lib/messageview.go
index 08ea92fb..4f1d0cde 100644
--- a/lib/messageview.go
+++ b/lib/messageview.go
@@ -34,6 +34,9 @@ type MessageView interface {
}
func usePGP(info *models.BodyStructure) bool {
+ if info == nil {
+ return false
+ }
if info.MIMEType == "application" {
if info.MIMESubType == "pgp-encrypted" ||
info.MIMESubType == "pgp-signature" {