Fixing a possible crash in CopyCandidatesFromSessionDescription.
BUG=590972
R=pthatcher@webrtc.org
Review URL: https://codereview.webrtc.org/1754803002 .
Cr-Commit-Position: refs/heads/master@{#11835}
diff --git a/webrtc/api/webrtcsessiondescriptionfactory.cc b/webrtc/api/webrtcsessiondescriptionfactory.cc
index aa929d3..8b17135 100644
--- a/webrtc/api/webrtcsessiondescriptionfactory.cc
+++ b/webrtc/api/webrtcsessiondescriptionfactory.cc
@@ -112,6 +112,9 @@
source_desc->candidates(mediasection_index);
const IceCandidateCollection* dest_candidates =
dest_desc->candidates(mediasection_index);
+ if (!source_candidates || !dest_candidates) {
+ return;
+ }
for (size_t n = 0; n < source_candidates->count(); ++n) {
const IceCandidateInterface* new_candidate = source_candidates->at(n);
if (!dest_candidates->HasCandidate(new_candidate)) {