You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've seen some crashes in WooCommerce for iOS coming from our AztecEditor wrapper. This seems to come from the underlying usage of paragraphRange, since assumes that the attachment passed into the method is the string, force-unwrapping the first result of the attachments array:
func paragraphRange(for attachment: NSTextAttachment) -> NSRange {
// We assume the attachment IS in the string. This method should not be called otherwise.
let attachmentRange = ranges(forAttachment: attachment).first!
return paragraphRange(for: attachmentRange)
}
This leads to unexpected crashes when the method is not used as intended, since its signature does not specify that the result could be nil. Ideally we should change the returning type to NSRange?, or handle the existence of nil values internally.