forked from organicmaps/organicmaps
[iOS] PP: Bookmarks crash fix on unsupported image formats
https://jira.mail.ru/browse/MAPSME-12001
This commit is contained in:
parent
e7650967bf
commit
41287d7fd3
1 changed files with 2 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue