From 595b448269579f524cfdd67764eaa95999e9db2d Mon Sep 17 00:00:00 2001 From: Manish Meganathan Date: Fri, 22 Mar 2024 11:28:29 +0530 Subject: [PATCH] allow byte arrays to decode from null values added a condition to depolorizeByteArrayValue that allows it to decode null values into the zero value for the byte array --- depolorizer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/depolorizer.go b/depolorizer.go index 454ce0a..7376fa5 100644 --- a/depolorizer.go +++ b/depolorizer.go @@ -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"}