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:
Added a guard check to ensure the image size is acceptable before sending it to UIGraphicsBeginImageContextWithOptions
Move the guard check for Gutenberge comment on the top before proceeding to render an image.
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.
[x] I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.
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:
UIGraphicsBeginImageContextWithOptions
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.CHANGELOG.md
if necessary.