Skip to content

Commit a61571a

Browse files
cdga777cloudwebrtc
authored andcommitted
to prevent null reference
1 parent 507b16b commit a61571a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Runtime/Scripts/Room.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,14 @@ RemoteParticipant CreateRemoteParticipantWithTracks(ConnectCallback.Types.Partic
354354
var publications = item.Publications;
355355
var newParticipant = new RemoteParticipant(participant, this);
356356
_participants.Add(participant.Info.Sid, newParticipant);
357-
foreach (var pub in publications)
357+
if (publications != null)
358358
{
359-
var publication = new RemoteTrackPublication(pub.Info);
360-
newParticipant._tracks.Add(publication.Sid, publication);
361-
newParticipant.OnTrackPublished(publication);
359+
foreach (var pub in publications)
360+
{
361+
var publication = new RemoteTrackPublication(pub.Info);
362+
newParticipant._tracks.Add(publication.Sid, publication);
363+
newParticipant.OnTrackPublished(publication);
364+
}
362365
}
363366
return newParticipant;
364367
}

0 commit comments

Comments
 (0)