wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.97k stars 1.32k forks source link

Crash when adding an image from the gallery #5551

Closed 0nko closed 7 years ago

0nko commented 7 years ago
java.lang.IndexOutOfBoundsException: setSpan (1 ... 2) ends beyond length 1
at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1090)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:665)
at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:658)
at org.wordpress.aztec.formatting.LineBlockFormatter.insertMedia(LineBlockFormatter.kt:146)
at org.wordpress.aztec.AztecText.insertMedia(AztecText.kt:972)
at org.wordpress.android.editor.AztecEditorFragment.appendMediaFile(AztecEditorFragment.java:466)
at org.wordpress.android.ui.posts.EditPostActivity.addMediaVisualEditor(EditPostActivity.java:1716)
at org.wordpress.android.ui.posts.EditPostActivity.addMedia(EditPostActivity.java:1688)
at org.wordpress.android.ui.posts.EditPostActivity.onPhotoPickerMediaChosen(EditPostActivity.java:618)
at org.wordpress.android.ui.photopicker.PhotoPickerFragment$4.onItemTapped(PhotoPickerFragment.java:133)

Reproduced on WP alpha-45 with Aztec v0.5.0-alpha.4

catehstn commented 7 years ago

This makes the current alpha unusable - is there an ETA on fixing it?

0nko commented 7 years ago

I'll try to have it ready for the next wpandroid alpha-release.

lancewillett commented 7 years ago

I ran into this today in the Android app version alpha-45

  1. Make sure Aztec editor is turned on in settings.
  2. Create a new post.
  3. Click the "add media" button in the editor toolbar.
  4. Click on an image to add to the post
  5. App crashes.

I sent my crash log just now via the app.

designsimply commented 7 years ago

Tested using WP Desktop alpha-45 and was unable to reproduce the problem (screenshot).

supernovia commented 7 years ago

I've also reproduced this in alpha-45. I did notice the media is added to the library, just not to the post.

mzorz commented 7 years ago

Managed to repro this if the first action you take on a new post is just try to add the media on the first line, without entering any text. If you do enter some text, it does not crash.

0nko commented 7 years ago

The problem was identified and fixed. Stay put for the next alpha release :).

mzorz commented 7 years ago

🙇 thank you @0nko !

designsimply commented 7 years ago

@0nko, which number release will have the fix? I just tested again based on mzorz's instructions ^ and and was able to crash the app while testing with alpha-46.

supernovia commented 7 years ago

I also have that crash on alpha-46

0nko commented 7 years ago

What instructions are you referring to? The new Aztec release is included in the alpha-47 build.

lancewillett commented 7 years ago

I haven't seen alpha-47 build come through yet to my phone.

mzorz commented 7 years ago

I haven't seen alpha-47 build come through yet to my phone.

Hi @lancewillett - it's been pushed to full rollout about 3 hours ago, so I guess it should reach everyone shortly if not already

designsimply commented 7 years ago

Re-tested with alpha-49 and was unable to reproduce. LGTM 👍

lancewillett commented 7 years ago

Same here — testing again with alpha-49 and works as expected. 🔆

0nko commented 7 years ago

Woohoo! :smile: