Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StringIndexOutOfBoundsException: length=0; index=0 #20738

Closed
sentry-io bot opened this issue Apr 30, 2024 · 13 comments · Fixed by wordpress-mobile/AztecEditor-Android#1080 or #20771
Closed

StringIndexOutOfBoundsException: length=0; index=0 #20738

sentry-io bot opened this issue Apr 30, 2024 · 13 comments · Fixed by wordpress-mobile/AztecEditor-Android#1080 or #20771
Assignees
Milestone

Comments

@sentry-io
Copy link

sentry-io bot commented Apr 30, 2024

Sentry Issue: JETPACK-ANDROID-QWX

StringIndexOutOfBoundsException: length=0; index=0
    at org.wordpress.android.editor.AztecEditorFragment.parseContent(AztecEditorFragment.java:2283)
    at org.wordpress.android.editor.AztecEditorFragment.hasMediaItemsMarkedWithTag(AztecEditorFragment.java:2223)
    at org.wordpress.android.editor.AztecEditorFragment.hasMediaItemsMarkedUploading(AztecEditorFragment.java:2213)
    at org.wordpress.android.ui.posts.EditPostActivity$resetUploadingMediaToFailedIfPostHasNotMediaInProgressOrQueued$1.invoke(EditPostActivity.kt:1098)
    if ((!AztecEditorFragment.hasMediaItemsMarkedUploading(this@EditPostActivity, oldContent)
    at org.wordpress.android.ui.posts.EditPostActivity$resetUploadingMediaToFailedIfPostHasNotMediaInProgressOrQueued$1.invoke(EditPostActivity.kt:1096)
    editPostRepository.updateAsync({ postModel: PostModel ->
...
(25 additional frame(s) were not displayed)
@dangermattic
Copy link
Collaborator

Thanks for reporting! 👍

@thomashorta
Copy link
Contributor

@antonis, I did some quick investigation here and it looks like there's a possibility that the CssStyleFormatter.getStyleAttribute(attributes, CssStyleFormatter.CSS_COLOR_ATTRIBUTE) evaluates to an empty string here in the Aztec code.

The problem is that a recent PR you worked on for Aztec (wordpress-mobile/AztecEditor-Android#1079) removed the check for isEmpty (https:/wordpress-mobile/AztecEditor-Android/pull/1079/files#diff-b072035f2c70a485070535d72bcbd20b0fdbc44c3044bbb2fc8db4c8efa1929fL20) and this is causing a crash on Jetpack 24.7 (which is when the changes were picked by #20704).

I will assign this crash to you for further investigation if that's OK. Feel free to take a look and assign someone else if it makes more sense.

Btw, I think a possible fix is replacing the null check inside safelyParseColor with colorString.isNullOrEmpty

@antonis
Copy link

antonis commented Apr 30, 2024

Thank you for the ping @thomashorta! Your investigation and suggested fix sounds reasonable to me.
I'm currently away from my computer and I would probably not be able to test and prepare a PR this week. If a fix is urgent please assign someone else on this.

@notandyvee
Copy link
Contributor

@antonis I can help out as I am tasked with helping improve the crash free rate.

Copy link
Author

sentry-io bot commented May 2, 2024

Sentry Issue: JETPACK-ANDROID-R34

Copy link
Author

sentry-io bot commented May 2, 2024

Sentry Issue: JETPACK-ANDROID-R23

@antonis
Copy link

antonis commented May 7, 2024

Thank you for covering for me @notandyvee 🙇

@antonis antonis added this to the 24.9 milestone May 7, 2024
Copy link
Author

sentry-io bot commented May 7, 2024

Sentry Issue: WORDPRESS-ANDROID-2Y16

@antonis antonis modified the milestones: 24.9, 24.8 ❄️ May 9, 2024
Copy link
Author

sentry-io bot commented May 9, 2024

Sentry Issue: JETPACK-ANDROID-R1T

Copy link
Author

sentry-io bot commented May 9, 2024

Sentry Issue: WORDPRESS-ANDROID-2Y7G

Copy link
Author

sentry-io bot commented May 9, 2024

Sentry Issue: WORDPRESS-ANDROID-2YBG

Copy link
Author

sentry-io bot commented May 9, 2024

Sentry Issue: WORDPRESS-ANDROID-2Y8B

Copy link
Author

sentry-io bot commented May 9, 2024

Sentry Issue: WORDPRESS-ANDROID-2Y7V

@irfano irfano modified the milestones: 24.8, 24.9 May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment