about summary refs log tree commit diff stats
path: root/worker/imap/fetch.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker/imap/fetch.go')
-rw-r--r--worker/imap/fetch.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go
index bc7144c..9591ced 100644
--- a/worker/imap/fetch.go
+++ b/worker/imap/fetch.go
@@ -82,10 +82,11 @@ func (imapw *IMAPWorker) handleFetchMessages(
 			case *types.FetchMessageHeaders:
 				reader := _msg.GetBody(section)
 				textprotoHeader, err := textproto.ReadHeader(bufio.NewReader(reader))
-				var header *mail.Header
-				if err == nil {
-					header = &mail.Header{message.Header{textprotoHeader}}
+				if err != nil {
+					done <- fmt.Errorf("could not read header: %v", err)
+					return
 				}
+				header := &mail.Header{message.Header{textprotoHeader}}
 				imapw.worker.PostMessage(&types.MessageInfo{
 					Message: types.RespondTo(msg),
 					Info: &models.MessageInfo{