Skip to content

Commit

Permalink
MEET-4480: Crash at ChatMediaCollectionViewCell
Browse files Browse the repository at this point in the history
  • Loading branch information
jnavarrom authored and rgmez committed Oct 4, 2024
1 parent ada7ec4 commit f74021f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions iMEGA/Chat Messages/Views/ChatMediaCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ class ChatMediaCollectionViewCell: MessageContentCell, MEGATransferDelegate {

if FileManager.default.fileExists(atPath: previewFilePath) || FileManager.default.fileExists(atPath: originalImagePath) {
loadingIndicator.stopAnimating()
if let previewImage = UIImage(contentsOfFile: previewFilePath) ?? UIImage(contentsOfFile: originalImagePath),
(previewImage.size.width / previewImage.size.height).precised(2) != (messageContainerView.frame.width / messageContainerView.frame.height).precised(2),
messagesCollectionView.numberOfSections > indexPath.section {
imageView.image = nil
messagesCollectionView.reloadItems(at: [indexPath])
if #unavailable(iOS 18.0) {
if let previewImage = UIImage(contentsOfFile: previewFilePath) ?? UIImage(contentsOfFile: originalImagePath),
(previewImage.size.width / previewImage.size.height).precised(2) != (messageContainerView.frame.width / messageContainerView.frame.height).precised(2),
messagesCollectionView.numberOfSections > indexPath.section {
imageView.image = nil
messagesCollectionView.reloadItems(at: [indexPath])
}
}
} else {
downloadGifIcon.isHidden = true
Expand Down

0 comments on commit f74021f

Please sign in to comment.