Skip to content

Commit

Permalink
Ensure positive Len on cast
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Dec 5, 2023
1 parent a7b0ac0 commit 72e7fc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 72e7fc9

Please sign in to comment.