Skip to content

Commit bd0ed3b

Browse files
conference: check for nil rtp tracks
1 parent 673a0aa commit bd0ed3b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/conference/processor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ func (c *Conference) handleDataChannelMessage(participant *Participant, sfuMessa
140140

141141
// Get the tracks that correspond to the tracks that the participant wants to receive.
142142
for _, track := range c.getTracks(sfuMessage.Start) {
143+
if track == nil {
144+
participant.logger.Errorf("Bug, track is nil")
145+
}
146+
143147
if err := participant.peer.SubscribeTo(track); err != nil {
144148
participant.logger.Errorf("Failed to subscribe to track: %v", err)
145149
return

pkg/conference/state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (c *Conference) getAvailableStreamsFor(forParticipant ParticipantID) event.
7979

8080
// Helper that returns the list of streams inside this conference that match the given stream IDs.
8181
func (c *Conference) getTracks(identifiers []event.SFUTrackDescription) []*webrtc.TrackLocalStaticRTP {
82-
tracks := make([]*webrtc.TrackLocalStaticRTP, len(identifiers))
82+
tracks := make([]*webrtc.TrackLocalStaticRTP, 0)
8383
for _, participant := range c.participants {
8484
// Check if this participant has any of the tracks that we're looking for.
8585
for _, identifier := range identifiers {

0 commit comments

Comments
 (0)