Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions osc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
2 changes: 1 addition & 1 deletion osc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestToBytes(t *testing.T) {
}{
{
Input: "",
Expected: []byte{},
Expected: []byte{0, 0, 0, 0},
},
{
Input: "a",
Expand Down