]> git.bitcoin.ninja Git - dnssec-prover/commitdiff
Correct `TxtBytes` iteration behavior, fixing `Txt::json()`
authorMatt Corallo <git@bluematt.me>
Tue, 9 Jul 2024 21:28:25 +0000 (21:28 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 9 Jul 2024 21:30:25 +0000 (21:30 +0000)
src/rr.rs

index 5aa7a5774c7e2f09903b8ab8b7065aa1b62c8242..a09661806888f9f6772196ac1b4144d32d4515b5 100644 (file)
--- a/src/rr.rs
+++ b/src/rr.rs
@@ -369,13 +369,14 @@ impl<'a> Iterator for TxtBytesIter<'a> {
                        .and_then(|part| if self.next_byte >= part.len.get() {
                                None
                        } else {
+                               let res = Some(part.bytes[self.next_byte as usize]);
                                if self.next_byte == part.len.get() - 1 {
                                        self.next_byte = 0;
                                        self.next_part += 1;
                                } else {
                                        self.next_byte += 1;
                                }
-                               Some(part.bytes[self.next_byte as usize])
+                               res
                        })
        }
 }