From f32a0b5e61f2f2ca56a69b168d57b057b749a7c5 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Thu, 12 Jan 2017 15:23:07 +0100 Subject: [PATCH] Fix crashes : DL emcrypted without Lime. Trying to display NULL auth_info --- Classes/AssistantLinkView.m | 10 ++++++---- Classes/Utils/FileTransferDelegate.m | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Classes/AssistantLinkView.m b/Classes/AssistantLinkView.m index aad8083b9..7cc66f4ae 100644 --- a/Classes/AssistantLinkView.m +++ b/Classes/AssistantLinkView.m @@ -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"); diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m index be9a9da89..5194dd72c 100644 --- a/Classes/Utils/FileTransferDelegate.m +++ b/Classes/Utils/FileTransferDelegate.m @@ -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];