fix crash when linphone_core_get_video_device() is NULL

This commit is contained in:
Paul Cartier 2020-05-27 11:02:06 +02:00
parent c6d0dfb21f
commit 8b54fb0f6c

View file

@ -1471,14 +1471,14 @@ void assistant_is_account_linked(LinphoneAccountCreator *creator, LinphoneAccoun
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];
//[UIViewController attemptRotationToDeviceOrientation];
AVCaptureDevice *backCamera = [AVCaptureDevice defaultDeviceWithDeviceType:AVCaptureDeviceTypeBuiltInWideAngleCamera mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionBack];
if (![[NSString stringWithUTF8String:linphone_core_get_video_device(LC)] containsString:[backCamera uniqueID]]) {
if (![[NSString stringWithUTF8String:linphone_core_get_video_device(LC) ?: ""] containsString:[backCamera uniqueID]]) {
bctbx_list_t *deviceList = linphone_core_get_video_devices_list(LC);
NSMutableArray *devices = [NSMutableArray array];
while (deviceList) {
char *data = deviceList->data;
[devices addObject:[NSString stringWithUTF8String:data]];
if (data) [devices addObject:[NSString stringWithUTF8String:data]];
deviceList = deviceList->next;
}
bctbx_list_free(deviceList);