Skip to content

Commit cf10e7b

Browse files
committed
Fix crash in CommentAttachmentRenderer when attempting to render Gutenberg comments
1 parent 848473b commit cf10e7b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Aztec/Classes/Renderers/CommentAttachmentRenderer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ extension CommentAttachmentRenderer: TextViewAttachmentImageProvider {
3636
}
3737

3838
public func textView(_ textView: TextView, imageFor attachment: NSTextAttachment, with size: CGSize) -> UIImage? {
39-
UIGraphicsBeginImageContextWithOptions(size, false, 0)
40-
4139
// Either this is a comment attachment, or the logic is broken.
4240
let commentAttachment = attachment as! CommentAttachment
4341

4442
guard !isGutenbergComment(commentAttachment) else {
4543
return nil
4644
}
4745

46+
UIGraphicsBeginImageContextWithOptions(size, false, 0)
47+
4848
let message = messageAttributedString()
4949
let targetRect = boundingRect(for: message, size: size)
5050

0 commit comments

Comments
 (0)