mirror of
https://github.com/Monibuca/engine.git
synced 2025-12-24 13:18:07 +08:00
fix: rtmp encode nil value
This commit is contained in:
@@ -248,6 +248,10 @@ func (amf *AMF) Marshal(v any) []byte {
|
||||
amf.WriteByte(0)
|
||||
}
|
||||
case EcmaArray:
|
||||
if vv == nil {
|
||||
amf.WriteByte(AMF0_NULL)
|
||||
return amf.Buffer
|
||||
}
|
||||
amf.WriteByte(AMF0_ECMA_ARRAY)
|
||||
amf.WriteUint32(uint32(len(vv)))
|
||||
for k, v := range vv {
|
||||
@@ -255,6 +259,10 @@ func (amf *AMF) Marshal(v any) []byte {
|
||||
}
|
||||
amf.Write(END_OBJ)
|
||||
case map[string]any:
|
||||
if vv == nil {
|
||||
amf.WriteByte(AMF0_NULL)
|
||||
return amf.Buffer
|
||||
}
|
||||
amf.WriteByte(AMF0_OBJECT)
|
||||
for k, v := range vv {
|
||||
amf.writeProperty(k, v)
|
||||
|
||||
Reference in New Issue
Block a user