From 4021458be81921e18442c29bca0a6f3848f7d1d1 Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 5 Apr 2024 12:21:36 -0500 Subject: [PATCH] Prevent divided-by-zero for empty BytesStreams --- src/bytes_stream.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bytes_stream.rs b/src/bytes_stream.rs index 4584983..f4e3853 100644 --- a/src/bytes_stream.rs +++ b/src/bytes_stream.rs @@ -35,7 +35,7 @@ impl BytesStream { tracing::debug!( "BytesStream with {} chunks, avg length {}", bs.chunks_len(), - bs.len() / bs.chunks_len() + bs.len() / bs.chunks_len().max(1) ); Ok(bs)