Fix crashes : DL emcrypted without Lime. Trying to display NULL auth_info

This commit is contained in:
Benjamin Reis 2017-01-12 15:23:07 +01:00
parent ab3b7d8f5e
commit f32a0b5e61
2 changed files with 24 additions and 4 deletions

View file

@ -57,10 +57,12 @@
linphone_account_creator_set_username(
account_creator, linphone_address_get_username(linphone_proxy_config_get_identity_address(cfg)));
const LinphoneAuthInfo *info = linphone_proxy_config_find_auth_info(cfg);
if (linphone_auth_info_get_passwd(info))
linphone_account_creator_set_password(account_creator, linphone_auth_info_get_passwd(info));
else
linphone_account_creator_set_ha1(account_creator, linphone_auth_info_get_ha1(info));
if (info) {
if (linphone_auth_info_get_passwd(info))
linphone_account_creator_set_password(account_creator, linphone_auth_info_get_passwd(info));
else
linphone_account_creator_set_ha1(account_creator, linphone_auth_info_get_ha1(info));
}
linphone_account_creator_set_domain(account_creator, linphone_proxy_config_get_domain(cfg));
} else {
LOGW(@"Default proxy is NOT a sip.linphone.org, aborting");

View file

@ -47,6 +47,24 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
// we're finished, save the image and update the message
UIImage *image = [UIImage imageWithData:thiz.data];
if (!image) {
UIAlertController *errView = [UIAlertController
alertControllerWithTitle:NSLocalizedString(@"File download error", nil)
message:NSLocalizedString(@"Error while downloading the file.\n"
@"The file is probably emcrypted.\n"
@"Please retry to download this file after activating LIME.",
nil)
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action){
}];
[errView addAction:defaultAction];
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
return;
}
CFBridgingRetain(thiz);
[[LinphoneManager.instance fileTransferDelegates] removeObject:thiz];