From 41287d7fd3afe2fa137d620f88e95d91f0f888b5 Mon Sep 17 00:00:00 2001 From: Alexander Boriskov Date: Mon, 11 Nov 2019 14:28:03 +0300 Subject: [PATCH] [iOS] PP: Bookmarks crash fix on unsupported image formats https://jira.mail.ru/browse/MAPSME-12001 --- iphone/Maps/Categories/NSAttributedString+HTML.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iphone/Maps/Categories/NSAttributedString+HTML.swift b/iphone/Maps/Categories/NSAttributedString+HTML.swift index c4d426ae68..aa9a26a24e 100644 --- a/iphone/Maps/Categories/NSAttributedString+HTML.swift +++ b/iphone/Maps/Categories/NSAttributedString+HTML.swift @@ -68,8 +68,8 @@ extension NSMutableAttributedString { func enumerateAttachments(estimatedWidth: CGFloat) { enumerateAttribute(.attachment, in: NSMakeRange(0, length), options: []) { (value, range, _) in - if let attachement = value as? NSTextAttachment { - let image = attachement.image(forBounds: attachement.bounds, textContainer: NSTextContainer(), characterIndex: range.location)! + if let attachement = value as? NSTextAttachment, + let image = attachement.image(forBounds: attachement.bounds, textContainer: NSTextContainer(), characterIndex: range.location) { if image.size.width > estimatedWidth { let newImage = resizeImage(image: image, scale: estimatedWidth/image.size.width) ?? image let resizedAttachment = NSTextAttachment()