Skip to content

Commit

Permalink
fix: conditionless switch for handling data=0, size>0 in Decoder.read…
Browse files Browse the repository at this point in the history
…Block()
  • Loading branch information
lukrah committed Jan 23, 2025
1 parent 6e53932 commit d3d6d16
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ocf/ocf.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ func (d *Decoder) readBlock() int64 {
size := d.reader.ReadLong()

// Read the blocks data
if count > 0 {
switch {
case count > 0:
data := make([]byte, size)
d.reader.Read(data)

Expand All @@ -197,8 +198,9 @@ func (d *Decoder) readBlock() int64 {
}

d.resetReader.Reset(data)
} else if size > 0 {
// Skip the block data

case size > 0:
// Skip the block data when count is 0
data := make([]byte, size)
d.reader.Read(data)
}
Expand Down

0 comments on commit d3d6d16

Please sign in to comment.