wordpress-mobile / AztecEditor-Android

A reusable native Android rich text editor component.
Mozilla Public License 2.0
675 stars 112 forks source link

[Bug] Fix crash and add unit test to cover the issue. #1080

Closed notandyvee closed 1 week ago

notandyvee commented 2 weeks ago

Fix

Fixes: https://github.com/wordpress-mobile/WordPress-Android/issues/20738

Fix a crash that occurs when a gutenberg post is being edited and there is a block with text color on it, it's possible for the color to be malformed or not parselable. The reasoning for how the Color is empty is not clear, but the function is clear that an empty string is possible. Added unit test to also confirm this covers both an empty and null string color.

Test

  1. Run the test project and ensure you see no crash.
  2. Ensure MarkSpanTest passes.

Review

@thomashorta or @antonis

Make sure strings will be translated:

notandyvee commented 2 weeks ago

@thomashorta ready for re-review 🙏🏻

notandyvee commented 1 week ago

@thomashorta I responded to your bigger point. But I made slightly bigger changes in response. As it turns out, I didn't even need to mock anything 🤦🏻 . Since we really only care about the crashes, this makes the most sense. Appreciate you elaborating as it helped me noticed an oversight I made.