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}
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
index 99a0db3..428eb24 100644
--- a/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
+++ b/webrtc/sdk/objc/Framework/Classes/RTCPeerConnection.mm
@@ -232,6 +232,9 @@
nullptr,
nullptr,
_observer.get());
+ if (!_peerConnection) {
+ return nil;
+ }
_localStreams = [[NSMutableArray alloc] init];
_delegate = delegate;
}