Skip to content

Commit 0eab188

Browse files
tyohanSean-Der
authored andcommitted
Fix zero payload size cause panic
1 parent bfda3e0 commit 0eab188

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/nack/retainable_packet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (m *packetManager) NewPacket(header *rtp.Header, payload []byte, rtxSsrc ui
7878

7979
// Remove padding if present.
8080
paddingLength := 0
81-
if p.header.Padding {
81+
if p.header.Padding && p.payload != nil && len(p.payload) > 0 {
8282
paddingLength = int(p.payload[len(p.payload)-1])
8383
p.header.Padding = false
8484
}

0 commit comments

Comments
 (0)