forked from security/hakurei
internal/pipewire: spa_dict size nil check
This fixes serialisation of NULL spa_dict. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -467,6 +467,10 @@ type SPADict struct {
|
|||||||
|
|
||||||
// Size satisfies [KnownSize] with a value computed at runtime.
|
// Size satisfies [KnownSize] with a value computed at runtime.
|
||||||
func (d *SPADict) Size() Word {
|
func (d *SPADict) Size() Word {
|
||||||
|
if d == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
// struct prefix, NItems value
|
// struct prefix, NItems value
|
||||||
size := SizePrefix + int(Size(SizeInt))
|
size := SizePrefix + int(Size(SizeInt))
|
||||||
for i := range d.Items {
|
for i := range d.Items {
|
||||||
|
|||||||
Reference in New Issue
Block a user