From f781bb57c3b4ebbb1faf54dbc09f460ddfa1ac8d Mon Sep 17 00:00:00 2001 From: Yves Gerey Date: Tue, 23 Jul 2019 19:15:39 +0200 Subject: [PATCH] [Unit test] Add check to prevent segfault on empty vector. We rather have an unmet expectation than let the test crash. Bug: webrtc:10827 Change-Id: I9e3d2dfb7cb856976305cd50377a71a2ed2ab4b2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146700 Commit-Queue: Seth Hampson Reviewed-by: Seth Hampson Cr-Commit-Position: refs/heads/master@{#28651} --- pc/peer_connection_integrationtest.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc index b3ca36123f..f36ba1e52f 100644 --- a/pc/peer_connection_integrationtest.cc +++ b/pc/peer_connection_integrationtest.cc @@ -4863,6 +4863,7 @@ TEST_P(PeerConnectionIntegrationTest, GetSourcesVideo) { ASSERT_EQ(receiver->media_type(), cricket::MEDIA_TYPE_VIDEO); auto sources = receiver->GetSources(); ASSERT_GT(receiver->GetParameters().encodings.size(), 0u); + ASSERT_GT(sources.size(), 0u); EXPECT_EQ(receiver->GetParameters().encodings[0].ssrc, sources[0].source_id()); EXPECT_EQ(webrtc::RtpSourceType::SSRC, sources[0].source_type());