Skip to content

Commit

Permalink
Fix zero payload size cause panic
Browse files Browse the repository at this point in the history
  • Loading branch information
tyohan committed Oct 7, 2024
1 parent bfda3e0 commit f074cca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/nack/retainable_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (m *packetManager) NewPacket(header *rtp.Header, payload []byte, rtxSsrc ui

// Remove padding if present.
paddingLength := 0
if p.header.Padding {
if p.header.Padding && p.payload != nil && len(p.payload) > 0 {
paddingLength = int(p.payload[len(p.payload)-1])
p.header.Padding = false
}
Expand Down

0 comments on commit f074cca

Please sign in to comment.