From 1df080f53b723addc46848967d4ef8ceca4b5cdd Mon Sep 17 00:00:00 2001 From: Ricardo Corrie Date: Mon, 29 Aug 2022 15:07:52 -0500 Subject: [PATCH] fix: [MOB-4845] Crashlytics: [__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray --- ios/RNCallKeep/RNCallKeep.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ios/RNCallKeep/RNCallKeep.m b/ios/RNCallKeep/RNCallKeep.m index 04474b9c..289eebd5 100644 --- a/ios/RNCallKeep/RNCallKeep.m +++ b/ios/RNCallKeep/RNCallKeep.m @@ -178,7 +178,12 @@ + (void)initCallKitProvider { } + (NSString *) getAudioOutput { - return [AVAudioSession sharedInstance].currentRoute.outputs.count > 0 ? [AVAudioSession sharedInstance].currentRoute.outputs[0].portType : nil; + @try{ + return [AVAudioSession sharedInstance].currentRoute.outputs.count > 0 ? [AVAudioSession sharedInstance].currentRoute.outputs[0].portType : nil; + }@catch(NSException *e){ + NSLog(@"[RNCallKeep][getAudioOutput] exception: %@",e); + return nil; + } } + (void)setup:(NSDictionary *)options {