From 5407ee03aeb3a1779db1575cbe6bd373a074aee1 Mon Sep 17 00:00:00 2001 From: Erik Hortsch Date: Thu, 16 Jul 2026 13:36:03 -0700 Subject: [PATCH] rtc: guard against nil subscriber in TransportManager.HandleAnswer (#4680) In single-PC and one-shot signalling modes the subscriber PCTransport is never created, so t.subscriber is nil. Every other TransportManager method that touches the subscriber nil-checks it first; HandleAnswer did not, so a client sending an SDP answer in those modes crashed the process with a nil pointer dereference. Guard it and log, matching AddICECandidate/Negotiate. Co-authored-by: Claude Opus 4.8 --- pkg/rtc/transportmanager.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/rtc/transportmanager.go b/pkg/rtc/transportmanager.go index ce01ac765..8257c1023 100644 --- a/pkg/rtc/transportmanager.go +++ b/pkg/rtc/transportmanager.go @@ -560,6 +560,11 @@ func (t *TransportManager) ProcessPendingPublisherOffer() { } func (t *TransportManager) HandleAnswer(answer webrtc.SessionDescription, answerId uint32) { + if t.subscriber == nil { + // no subscriber transport in single-PC / one-shot signalling mode + t.params.Logger.Warnw("answer received, but no subscriber peer connection", nil) + return + } t.subscriber.HandleRemoteDescription(answer, answerId) }