Skip to content

Commit

Permalink
allow byte arrays to decode from null values
Browse files Browse the repository at this point in the history
added a condition to depolorizeByteArrayValue that allows it to decode null values into the zero value for the byte array
  • Loading branch information
sarvalabs-manish committed Mar 22, 2024
1 parent 0d4a7cb commit 595b448
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions depolorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ func (depolorizer *Depolorizer) depolorizeByteArrayValue(target reflect.Type) (r
return zeroVal, err
}

// If data is nil, return zero value
if len(bytes) == 0 {
return zeroVal, nil
}

// Check array length
if target.Len() != len(bytes) {
return zeroVal, IncompatibleWireError{"mismatched data length for byte array"}
Expand Down

0 comments on commit 595b448

Please sign in to comment.