From 891f29c37dbd127b0b64accdaa7bd30ebf7726cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Mon, 9 Nov 2020 14:32:35 -0500 Subject: [PATCH] sipcall: check media_tr avoid segfault. Backtrace from the play store Change-Id: I5a44a5ee190cba22ed31ef4c7f64703b352db7fe --- src/sip/sipcall.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp index a6e40327e..5290e9c09 100644 --- a/src/sip/sipcall.cpp +++ b/src/sip/sipcall.cpp @@ -1034,9 +1034,13 @@ SIPCall::setupLocalSDPFromIce() std::vector SIPCall::getAllRemoteCandidates() { - std::vector rem_candidates; auto media_tr = getIceMediaTransport(); + if (not media_tr) { + JAMI_WARN("[call:%s] no media ICE transport", getCallId().c_str()); + return {}; + } + auto addSDPCandidates = [&, this](unsigned sdpMediaId, std::vector& out) { IceCandidate cand; for (auto& line : sdp_->getIceCandidates(sdpMediaId)) { @@ -1049,6 +1053,7 @@ SIPCall::getAllRemoteCandidates() } }; + std::vector rem_candidates; addSDPCandidates(SDP_AUDIO_MEDIA_ID, rem_candidates); #ifdef ENABLE_VIDEO addSDPCandidates(SDP_VIDEO_MEDIA_ID, rem_candidates);