Skip to content

Commit

Permalink
encoding fix: write typeNIL
Browse files Browse the repository at this point in the history
So far it was working aonly because typeNIL==0, and buffer
was zero-initilized. But it's wrong to rely on that.
  • Loading branch information
wkhere committed Feb 25, 2025
1 parent 923ad58 commit c39a44b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func valueToBytes(p []byte, v value) (n int) {

default:
if v == nil {
p[0] = byte(typeNIL)
return 1 + 0 // don't emit nil value, just the type
}
panic(errInvalidValue{v})
Expand Down

0 comments on commit c39a44b

Please sign in to comment.