From 404e260b005eb9f4ed19a47da3d9180184e834c3 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 9 Jul 2024 21:28:25 +0000 Subject: [PATCH] Correct `TxtBytes` iteration behavior, fixing `Txt::json()` --- src/rr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rr.rs b/src/rr.rs index 5aa7a57..a096618 100644 --- 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 }) } } -- 2.39.5