Fix attachment processor error handling

This commit is contained in:
Daniel Huigens 2022-02-11 16:09:28 +01:00
parent 16358e82ba
commit 682166d9e3

View file

@ -54,6 +54,9 @@ func (ap *AttachmentProcessor) Finish() (*PGPSplitMessage, error) {
} }
ap.done.Wait() ap.done.Wait()
if ap.err != nil {
return nil, ap.err
}
splitMsg := ap.split splitMsg := ap.split
if ap.garbageCollector > 0 { if ap.garbageCollector > 0 {
@ -94,7 +97,7 @@ func (keyRing *KeyRing) newAttachmentProcessor(
Data: ciphertext, Data: ciphertext,
} }
split, splitError := message.SeparateKeyAndData(estimatedSize, garbageCollector) split, splitError := message.SeparateKeyAndData(estimatedSize, garbageCollector)
if attachmentProc.err != nil { if attachmentProc.err == nil {
attachmentProc.err = splitError attachmentProc.err = splitError
} }
attachmentProc.split = split attachmentProc.split = split