8000 fix : crash when `sdpMLineIndex` is null on `addCandidate` (#1153) · withub-com/flutter-webrtc@81fec36 · GitHub
[go: up one dir, main page]

Skip to content

Commit 81fec36

Browse files
authored
fix : crash when sdpMLineIndex is null on addCandidate (flutter-webrtc#1153)
1 parent 2521b22 commit 81fec36

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

common/darwin/Classes/FlutterWebRTCPlugin.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,11 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult) result
344344
NSString* peerConnectionId = argsMap[@"peerConnectionId"];
345345
NSDictionary* candMap = argsMap[@"candidate"];
346346
NSString *sdp = candMap[@"candidate"];
347-
int sdpMLineIndex = ((NSNumber*)candMap[@"sdpMLineIndex"]).intValue;
347+
id sdpMLineIndexValue = candMap[@"sdpMLineIndex"];
348+
int sdpMLineIndex = 0;
349+
if (![sdpMLineIndexValue isKindOfClass:[NSNull class]]) {
350+
sdpMLineIndex = ((NSNumber*)candMap[@"sdpMLineIndex"]).intValue;
351+
}
348352
NSString *sdpMid = candMap[@"sdpMid"];
349353

350354
RTCIceCandidate* candidate = [[RTCIceCandidate alloc] initWithSdp:sdp sdpMLineIndex:sdpMLineIndex sdpMid:sdpMid];

0 commit comments

Comments
 (0)
0