From 94d7ef6a79ea7b22ad094584fb66850b0c0c0759 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Thu, 21 May 2020 22:45:51 +0200 Subject: [PATCH] fix crash when send phontos --- Classes/ChatConversationView.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 34b16dcd6..e2fb19aa1 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -1250,6 +1250,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog [_imagesArray removeObjectAtIndex:key]; [_assetIdsArray removeObjectAtIndex:key]; [self refreshImageDrawer]; + [_imagesCollectionView reloadData]; } - (void)clearMessageView { @@ -1273,8 +1274,11 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog } else { imgFrame.size.height = 100; } - [imgView.image setImage:[UIImage resizeImage:[_imagesArray objectAtIndex:[indexPath item]] withMaxWidth:imgFrame.size.width andMaxHeight:imgFrame.size.height]]; - [imgView setAssetId:[_assetIdsArray objectAtIndex:[indexPath item]]]; + + if ([_imagesArray count] > 1) { + [imgView.image setImage:[UIImage resizeImage:[_imagesArray objectAtIndex:[indexPath item]] withMaxWidth:imgFrame.size.width andMaxHeight:imgFrame.size.height]]; + [imgView setAssetId:[_assetIdsArray objectAtIndex:[indexPath item]]]; + } [imgView setDeleteDelegate:self]; [imgView setFrame:imgFrame]; [_sendButton setEnabled:TRUE];