wordpress-mobile / AztecEditor-iOS

A reusable native iOS visual HTML text editor component.
Mozilla Public License 2.0
611 stars 146 forks source link

Fix crash when attempting to render Gutenberg comment #1383

Closed itsmeichigo closed 5 months ago

itsmeichigo commented 5 months ago

Fixes https://github.com/woocommerce/woocommerce-ios/issues/11770 Reported in peaMlT-p5-p2

Description

There's a recent crash found in Woo iOS happening in CommentAttachmentRenderer when attempting to render an image with an illegal size (-1, -1).

This PR fixes this crash with two steps:

Testing steps

When trying to reproduce the crash, I found that this happens when a product description in Woo contains some Gutenberg comments. I added similar comments to the Example/Example/SampleContent/content.html file, so you can test with the example app by tapping Standard demo and confirm that the app doesn't crash.