Skip to content

Commit 7bc0486

Browse files
Fix ICE candidate handling to ensure WebSocket is not nil before writing to signaling channel (jetkvm#1087)
1 parent cb44a02 commit 7bc0486

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

webrtc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func newSession(config SessionConfig) (*Session, error) {
369369

370370
peerConnection.OnICECandidate(func(candidate *webrtc.ICECandidate) {
371371
scopedLogger.Info().Interface("candidate", candidate).Msg("WebRTC peerConnection has a new ICE candidate")
372-
if candidate != nil {
372+
if candidate != nil && config.ws != nil {
373373
err := wsjson.Write(context.Background(), config.ws, gin.H{"type": "new-ice-candidate", "data": candidate.ToJSON()})
374374
if err != nil {
375375
scopedLogger.Warn().Err(err).Msg("failed to write new-ice-candidate to WebRTC signaling channel")

0 commit comments

Comments
 (0)