From 72e7fc9b77216fbad2dec8d35865522c3f862367 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Tue, 5 Dec 2023 13:05:57 -0500 Subject: [PATCH] Ensure positive Len on cast --- envelope.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/envelope.go b/envelope.go index b99a1504..6b333827 100644 --- a/envelope.go +++ b/envelope.go @@ -110,8 +110,8 @@ func (e *envelope) Seek(offset int64, whence int) (int64, error) { // Len returns the number of bytes of the unread portion of the envelope. func (e *envelope) Len() int { - if length := int64(e.Data.Len()) + 5 - e.offset; length > 0 { - return int(length) + if length := int(int64(e.Data.Len()) + 5 - e.offset); length > 0 { + return length } return 0 }