From 682166d9e353d043bacedb5ba48d16e0b846d8aa Mon Sep 17 00:00:00 2001 From: Daniel Huigens Date: Fri, 11 Feb 2022 16:09:28 +0100 Subject: [PATCH] Fix attachment processor error handling --- crypto/attachment.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crypto/attachment.go b/crypto/attachment.go index 2944002..a362d17 100644 --- a/crypto/attachment.go +++ b/crypto/attachment.go @@ -54,6 +54,9 @@ func (ap *AttachmentProcessor) Finish() (*PGPSplitMessage, error) { } ap.done.Wait() + if ap.err != nil { + return nil, ap.err + } splitMsg := ap.split if ap.garbageCollector > 0 { @@ -94,7 +97,7 @@ func (keyRing *KeyRing) newAttachmentProcessor( Data: ciphertext, } split, splitError := message.SeparateKeyAndData(estimatedSize, garbageCollector) - if attachmentProc.err != nil { + if attachmentProc.err == nil { attachmentProc.err = splitError } attachmentProc.split = split