8000 nullable return for GetLocalDescription/GetRemoteDiscription (darwin). · efraespada/flutter-webrtc@2a9ec03 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a9ec03

Browse files
committed
nullable return for GetLocalDescription/GetRemoteDiscription (darwin).
1 parent 562a5ed commit 2a9ec03

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

common/darwin/Classes/FlutterWebRTCPlugin.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,12 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult) result
574574
RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
575575
if(peerConnection) {
576576
RTCSessionDescription* sdp = peerConnection.localDescription;
577-
NSString *type = [RTCSessionDescription stringForType:sdp.type];
578-
result(@{@"sdp": sdp.sdp, @"type": type});
577+
if(nil == sdp){
578+
result(nil);
579+
}else{
580+
NSString *type = [RTCSessionDescription stringForType:sdp.type];
581+
result(@{@"sdp": sdp.sdp, @"type": type});
582+
}
579583
} else {
580584
result([FlutterError errorWithCode:[NSString stringWithFormat:@"%@Failed",call.method]
581585
message:[NSString stringWithFormat:@"Error: peerConnection not found!"]
@@ -587,8 +591,12 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult) result
587591
RTCPeerConnection *peerConnection = self.peerConnections[peerConnectionId];
588592
if(peerConnection) {
589593
RTCSessionDescription* sdp = peerConnection.remoteDescription;
590-
NSString *type = [RTCSessionDescription stringForType:sdp.type];
591-
result(@{@"sdp": sdp.sdp, @"type": type});
594+
if(nil == sdp){
595+
result(nil);
596+
}else{
597+
NSString *type = [RTCSessionDescription stringForType:sdp.type];
598+
result(@{@"sdp": sdp.sdp, @"type": type});
599+
}
592600
} else {
593601
result([FlutterError errorWithCode:[NSString stringWithFormat:@"%@Failed",call.method]
594602
message:[NSString stringWithFormat:@"Error: peerConnection not found!"]

0 commit comments

Comments
 (0)
0