diff --git a/osc.go b/osc.go index 5345af9..a36ae74 100644 --- a/osc.go +++ b/osc.go @@ -44,8 +44,8 @@ type Packet interface { // This means that the returned byte slice is padded with null bytes // so that it's length is a multiple of 4. func ToBytes(s string) []byte { - if len(s) == 0 { - return []byte{} + if s == "" { + return []byte{0, 0, 0, 0} } return Pad(append([]byte(s), 0)) } diff --git a/osc_test.go b/osc_test.go index 8bbdc7d..56ae0d2 100644 --- a/osc_test.go +++ b/osc_test.go @@ -12,7 +12,7 @@ func TestToBytes(t *testing.T) { }{ { Input: "", - Expected: []byte{}, + Expected: []byte{0, 0, 0, 0}, }, { Input: "a",