Skip to content

Commit d567cd1

Browse files
committed
Fix nil data blob
Signed-off-by: Joanna Lau <118241363+joannalauu@users.noreply.github.com>
1 parent 69bc8c0 commit d567cd1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

common/persistence/sql/sql_domain_audit_store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (m *sqlDomainAuditStore) GetDomainAuditLogs(
182182

183183
func getDataBlobBytes(blob *persistence.DataBlob) []byte {
184184
if blob == nil {
185-
return nil
185+
return []byte{}
186186
}
187187
return blob.Data
188188
}

common/persistence/sql/sql_domain_audit_store_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ func TestCreateDomainAuditLog(t *testing.T) {
105105
expectedRow := &sqlplugin.DomainAuditLogRow{
106106
DomainID: serialization.MustParseUUID("d1111111-1111-1111-1111-111111111111"),
107107
EventID: serialization.MustParseUUID("e1111111-1111-1111-1111-111111111111"),
108-
StateBefore: nil,
108+
StateBefore: []byte{},
109109
StateBeforeEncoding: "",
110-
StateAfter: nil,
110+
StateAfter: []byte{},
111111
StateAfterEncoding: "",
112112
OperationType: persistence.DomainAuditOperationTypeCreate,
113113
CreatedTime: now,
@@ -441,7 +441,7 @@ func TestGetDataBlobBytes(t *testing.T) {
441441
}{
442442
"nil blob": {
443443
input: nil,
444-
expected: nil,
444+
expected: []byte{},
445445
},
446446
"blob with data": {
447447
input: &persistence.DataBlob{

0 commit comments

Comments
 (0)