diff options
author | Neal H. Walfield <neal@pep.foundation> | 2022-12-28 15:07:36 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2023-01-06 13:24:56 +0100 |
commit | baabeba261c7403319272d07a680ec1482af5f50 (patch) | |
tree | 8532af00ac65a82bd53cae37eb6dc874bf9fe077 /openpgp/src/cert | |
parent | 7ae1dfc5bb52437cc384efb9a6c17d24642c9aa7 (diff) |
openpgp: Don't wait for EOF to return a queued error.
- When `CertParser::next` is called and there is a queued error,
return it immediately; don't wait for an EOF.
Diffstat (limited to 'openpgp/src/cert')
-rw-r--r-- | openpgp/src/cert/parser/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs index 3657c7d6..a6174c64 100644 --- a/openpgp/src/cert/parser/mod.rs +++ b/openpgp/src/cert/parser/mod.rs @@ -951,15 +951,16 @@ impl<'a> Iterator for CertParser<'a> { fn next(&mut self) -> Option<Self::Item> { tracer!(TRACE, "CertParser::next", 0); + if let Some(err) = self.queued_error.take() { + t!("Returning queued error: {}", err); + return Some(Err(err)); + } loop { match self.source.take() { None => { t!("EOF."); - if let Some(err) = self.queued_error.take() { - return Some(Err(err)); - } if self.packets.is_empty() { return None; } |