Skip to content

Commit

Permalink
getBytes: return nil instead of []byte{} when nil, consider []byte{} …
Browse files Browse the repository at this point in the history
…& nil equal
  • Loading branch information
serprex committed Feb 14, 2024
1 parent bcb3636 commit 0b1c49f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions flow/model/qvalue/qvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func compareBytes(value1, value2 interface{}) bool {
bytes1, ok1 := getBytes(value1)
bytes2, ok2 := getBytes(value2)

return ok1 && ok2 && bytes.Equal(bytes1, bytes2)
return ok1 && ok2 && (len(bytes1) == len(bytes2) || bytes.Equal(bytes1, bytes2))
}

func compareNumeric(value1, value2 interface{}) bool {
Expand Down Expand Up @@ -587,8 +587,7 @@ func getBytes(v interface{}) ([]byte, bool) {
case string:
return []byte(value), true
case nil:
// return empty byte array
return []byte{}, true
return nil, true
default:
return nil, false
}
Expand Down

0 comments on commit 0b1c49f

Please sign in to comment.