Fix panic when stopping import progress during loading mailboxes info

This commit is contained in:
Michal Horejsek
2021-01-25 09:07:04 +01:00
parent adcf0827ee
commit 0a0cc0a62c
2 changed files with 10 additions and 1 deletions

View File

@ -46,8 +46,12 @@ func (p *IMAPProvider) TransferTo(rules transferRules, progress *Progress, ch ch
imapMessageInfoMap := p.loadMessageInfoMap(rules, progress)
for rule := range rules.iterateActiveRules() {
log.WithField("rule", rule).Debug("Processing rule")
messagesInfo := imapMessageInfoMap[rule.SourceMailbox.Name]
if messagesInfo == nil {
log.WithField("rule", rule).Warn("Rule has no message info")
continue
}
log.WithField("rule", rule).Debug("Processing rule")
p.transferTo(rule, messagesInfo, progress, ch)
}
}
@ -67,6 +71,10 @@ func (p *IMAPProvider) loadMessageInfoMap(rules transferRules, progress *Progres
mailbox, err = p.selectIn(mailboxName)
return err
})
if mailbox == nil {
log.WithField("rule", rule.SourceMailbox.Name).Warn("Failed to select into mailbox")
continue
}
if mailbox.Messages == 0 {
continue
}

View File

@ -25,6 +25,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
* GODT-951 Properly parse message with long lines in header and long header split to multiple lines (upgrading to latest go-message).
* GODT-894 Fix panic when sending while account is logging in.
* GODT-831 Fix reporting bug from accounts with empty account name.
* GODT-991 Fix panic when stopping import progress during loading mailboxes info.
### Changed
* GODT-97 Don't log errors caused by SELECT "".