Handle case where server does not return body
This was causing a nil pointer dereference before. Fixes ~migadu/alps#121.
This commit is contained in:
parent
aaa30ead41
commit
793f261b62
1 changed files with 6 additions and 1 deletions
|
@ -510,7 +510,12 @@ func getMessagePart(conn *imapclient.Client, mboxName string, uid uint32, partPa
|
|||
return nil, nil, fmt.Errorf("server didn't return message")
|
||||
}
|
||||
|
||||
headerReader := bufio.NewReader(msg.GetBody(&partHeaderSection))
|
||||
body := msg.GetBody(&partHeaderSection)
|
||||
if body == nil {
|
||||
return nil, nil, fmt.Errorf("server didn't return message")
|
||||
}
|
||||
|
||||
headerReader := bufio.NewReader(body)
|
||||
h, err := textproto.ReadHeader(headerReader)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to read part header: %v", err)
|
||||
|
|
Loading…
Reference in a new issue