internal/pipewire: check nil marshaler
All checks were successful
Test / Create distribution (push) Successful in 43s
Test / Sandbox (push) Successful in 2m26s
Test / Sandbox (race detector) (push) Successful in 2m19s
Test / Hakurei (push) Successful in 2m34s
Test / Hakurei (race detector) (push) Successful in 3m9s
Test / Hpkg (push) Successful in 3m22s
Test / Flake checks (push) Successful in 1m33s
All checks were successful
Test / Create distribution (push) Successful in 43s
Test / Sandbox (push) Successful in 2m26s
Test / Sandbox (race detector) (push) Successful in 2m19s
Test / Hakurei (push) Successful in 2m34s
Test / Hakurei (race detector) (push) Successful in 3m9s
Test / Hpkg (push) Successful in 3m22s
Test / Flake checks (push) Successful in 1m33s
NULL values have special case in the format. This check ensures correctness serialising nil pointers. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
cfeb7818eb
commit
14e33f17e5
@ -120,7 +120,7 @@ func appendInner(data []byte, f func(data []byte) ([]byte, error)) ([]byte, erro
|
|||||||
|
|
||||||
// marshalValueAppendRaw implements [MarshalAppend] on [reflect.Value].
|
// marshalValueAppendRaw implements [MarshalAppend] on [reflect.Value].
|
||||||
func marshalValueAppend(data []byte, v reflect.Value) ([]byte, error) {
|
func marshalValueAppend(data []byte, v reflect.Value) ([]byte, error) {
|
||||||
if v.CanInterface() {
|
if v.CanInterface() && (v.Kind() != reflect.Pointer || !v.IsNil()) {
|
||||||
if m, ok := v.Interface().(PODMarshaler); ok {
|
if m, ok := v.Interface().(PODMarshaler); ok {
|
||||||
extraData, err := m.MarshalPOD()
|
extraData, err := m.MarshalPOD()
|
||||||
return append(data, extraData...), err
|
return append(data, extraData...), err
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user