From 9d0e3cbc3a52570b83bda7baa0527b16f95e614c Mon Sep 17 00:00:00 2001 From: Intege-rs Date: Sat, 13 Sep 2025 22:34:02 -0400 Subject: [PATCH] correctly handle 1 byte ranges --- sub/xpat/src/hexdump.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sub/xpat/src/hexdump.rs b/sub/xpat/src/hexdump.rs index 9b3263f..e37381d 100644 --- a/sub/xpat/src/hexdump.rs +++ b/sub/xpat/src/hexdump.rs @@ -44,15 +44,10 @@ impl<'s, T: Scannable + ?Sized, R: RangeBounds> Display for HexDump<'s, T (start, end) }; - // if there is nothing to print then just return... - // this also prevents the ilog below from crashing :) - if end == 0 || start > end { - write!(f,""); - return Ok(()) - } - // the number of digits the address column should have - let digits = (end.ilog(16) as usize + 1).max(4); + let digits = if end == 0 { 4 } else { + (end.ilog(16) as usize + 1).max(4) + }; for (mut addr, chunk) in ChunkIter::new(self.0, start) { for chunk in chunk.chunks(16) {