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 <noreply@anthropic.com>
This commit is contained in:
Erik Hortsch
2026-07-16 13:36:03 -07:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 8c14a617f5
commit 5407ee03ae
+5
View File
@@ -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)
}