Explorar el Código

Handle case where server does not return body

This was causing a nil pointer dereference before.

Fixes ~migadu/alps#121.
master
Drew DeVault hace 3 años
padre
commit
793f261b62
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. +6
    -1
      plugins/base/imap.go

+ 6
- 1
plugins/base/imap.go Ver fichero

@@ -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)


Cargando…
Cancelar
Guardar