Return nil from RTCPeerConnectionFactory when creation fails

RTCPeerConnectionFactory.createPeerConnection did not check the return
value of the native createPeerConnection() - so when the native PC
fails to be created, it could end up attempting to use a null pointer.

The change makes it return nil when the creation fails. The application
can then detect and respond to the failure.

Review-Url: https://codereview.webrtc.org/2240633004
Cr-Commit-Position: refs/heads/master@{#13732}
This commit is contained in:
skvlad
2016-08-11 14:29:25 -07:00
committed by Commit bot
parent fe1ffb141b
commit 588783adcd

View File

@ -232,6 +232,9 @@ void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved(
nullptr,
nullptr,
_observer.get());
if (!_peerConnection) {
return nil;
}
_localStreams = [[NSMutableArray alloc] init];
_delegate = delegate;
}