wordpress-mobile / AztecEditor-Android

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

Do not iterate in while when history cursor is outside of list range #1065

Closed planarvoid closed 5 months ago

planarvoid commented 6 months ago

Fix

This PR fixes the following crash. We shouldn't iterate the list if the cursor points out of it.

IndexOutOfBoundsException: Index: 10, Size: 0
    at java.util.LinkedList.checkElementIndex(LinkedList.java:559)
    at java.util.LinkedList.remove(LinkedList.java:529)
    at org.wordpress.aztec.History.doHandleHistory(History.kt:65)
    at org.wordpress.aztec.History$HistoryRunnable.run(History.kt:0)
    at android.os.Handler.handleCallback(Handler.java:938)

Test

  1. I think this is a race condition so there is no way to test this

Review

@khaykov

Make sure strings will be translated: