diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc index aba2d62b4a..4c54d6f5fe 100644 --- a/talk/app/webrtc/peerconnection.cc +++ b/talk/app/webrtc/peerconnection.cc @@ -186,6 +186,7 @@ bool ParseIceServerUrl(const PeerConnectionInterface::IceServer& server, // turn-port = *DIGIT std::vector tokens; std::string turn_transport_type = kUdpTransportType; + ASSERT(!url.empty()); rtc::tokenize(url, '?', &tokens); std::string uri_without_transport = tokens[0]; // Let's look into transport= param, if it exists. @@ -286,6 +287,10 @@ bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, for (const webrtc::PeerConnectionInterface::IceServer& server : servers) { if (!server.urls.empty()) { for (const std::string& url : server.urls) { + if (url.empty()) { + LOG(WARNING) << "Empty uri."; + continue; + } if (!ParseIceServerUrl(server, url, stun_config, turn_config)) { return false; } diff --git a/talk/app/webrtc/peerconnectionfactory_unittest.cc b/talk/app/webrtc/peerconnectionfactory_unittest.cc index 597a1740ca..8088588852 100644 --- a/talk/app/webrtc/peerconnectionfactory_unittest.cc +++ b/talk/app/webrtc/peerconnectionfactory_unittest.cc @@ -203,6 +203,7 @@ TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServers) { TEST_F(PeerConnectionFactoryTest, CreatePCUsingIceServersUrls) { PeerConnectionInterface::RTCConfiguration config; webrtc::PeerConnectionInterface::IceServer ice_server; + ice_server.urls.push_back(""); // Empty URLs should be ignored. ice_server.urls.push_back(kStunIceServer); ice_server.urls.push_back(kTurnIceServer); ice_server.urls.push_back(kTurnIceServerWithTransport);