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

IndexOutOfBoundsException on Select All->Cut in Markdown #560

Closed
avuton opened this issue May 30, 2019 · 3 comments
Closed

IndexOutOfBoundsException on Select All->Cut in Markdown #560

avuton opened this issue May 30, 2019 · 3 comments

Comments

@avuton
Copy link

avuton commented May 30, 2019

Describe the bug
'Select All' -> 'Cut' crashes the app with the following:

05-29 20:50:11.950 14173 14173 E AndroidRuntime: FATAL EXCEPTION: main
05-29 20:50:11.950 14173 14173 E AndroidRuntime: Process: it.niedermann.owncloud.notes, PID: 14173
05-29 20:50:11.950 14173 14173 E AndroidRuntime: java.lang.IndexOutOfBoundsException: charAt: 0 >= length 0
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:123)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.CharSequenceCharacterIterator.current(CharSequenceCharacterIterator.java:58)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.CharSequenceCharacterIterator.first(CharSequenceCharacterIterator.java:44)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.icu.text.RuleBasedBreakIterator.CISetIndex32(RuleBasedBreakIterator.java:1123)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.icu.text.RuleBasedBreakIterator.isBoundary(RuleBasedBreakIterator.java:503)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.method.WordIterator.isBoundary(WordIterator.java:95)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.Editor$SelectionHandleView.positionAtCursorOffset(Editor.java:5467)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.Editor$HandleView.invalidate(Editor.java:4577)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.Editor$SelectionModifierCursorController.invalidateHandles(Editor.java:6145)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.Editor.invalidateHandlesAndActionMode(Editor.java:1985)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.TextView.spanChange(TextView.java:9926)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.TextView$ChangeWatcher.onSpanRemoved(TextView.java:12548)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.sendSpanRemoved(SpannableStringBuilder.java:1292)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:500)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:799)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:787)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.yydcdut.markdown.utils.SyntaxUtils.removeSpans(SyntaxUtils.java:294)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.yydcdut.markdown.live.HeaderLive.format(HeaderLive.java:90)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.yydcdut.markdown.live.HeaderLive.onTextChanged(HeaderLive.java:63)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.yydcdut.markdown.live.LivePrepare.onTextChanged(LivePrepare.java:81)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.yydcdut.markdown.MarkdownEditText.onTextChanged4Controller(MarkdownEditText.java:252)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.yydcdut.markdown.MarkdownEditText.access$700(MarkdownEditText.java:44)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.yydcdut.markdown.MarkdownEditText$EditTextWatcher.onTextChanged(MarkdownEditText.java:176)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.TextView.sendOnTextChanged(TextView.java:9754)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.TextView.handleTextChanged(TextView.java:9851)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:12509)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:1263)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:575)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:229)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:36)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.TextView.deleteText_internal(TextView.java:12018)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.TextView.onTextContextMenuItem(TextView.java:11284)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.widget.Editor$TextActionModeCallback.onActionItemClicked(Editor.java:4181)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onActionItemClicked(DecorView.java:2392)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.view.FloatingActionMode$3.onMenuItemSelected(FloatingActionMode.java:98)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:776)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:148)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:923)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:913)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.view.FloatingActionMode.lambda$setFloatingToolbar$0(FloatingActionMode.java:123)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.view.-$$Lambda$FloatingActionMode$LU5MpPuKYDtwlFAuYhXYfzgLNLE.onMenuItemClick(Unknown Source:2)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.widget.FloatingToolbar$FloatingToolbarPopup$2.onClick(FloatingToolbar.java:443)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.view.View.performClick(View.java:6597)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.view.View.performClickInternal(View.java:6574)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.view.View.access$3100(View.java:778)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.view.View$PerformClick.run(View.java:25885)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:873)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:193)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6718)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
05-29 20:50:11.950 14173 14173 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
05-29 20:50:11.954  1307  1319 W ActivityManager:   Force finishing activity it.niedermann.owncloud.notes/.android.activity.EditNoteActivity
05-29 20:50:11.966 14173 14173 I Process : Sending signal. PID: 14173 SIG: 9
05-29 20:50:11.988   769 11257 I WifiHAL : event received NL80211_CMD_VENDOR, vendor_id = 0x1374, subcmd = 0xd
05-29 20:50:11.988  1307  1848 W InputDispatcher: channel '5b9beef it.niedermann.owncloud.notes/it.niedermann.owncloud.notes.android.activity.NotesListViewActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-29 20:50:11.988  1307  1848 E InputDispatcher: channel '5b9beef it.niedermann.owncloud.notes/it.niedermann.owncloud.notes.android.activity.NotesListViewActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
05-29 20:50:11.988  1307  1848 W InputDispatcher: channel '47edea5 PopupWindow:ad375d7 (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-29 20:50:11.988  1307  1848 E InputDispatcher: channel '47edea5 PopupWindow:ad375d7 (server)' ~ Channel is unrecoverably broken and will be disposed!
05-29 20:50:11.988  1307  1848 W InputDispatcher: channel '2aa36f7 PopupWindow:686652e (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-29 20:50:11.988  1307  1848 E InputDispatcher: channel '2aa36f7 PopupWindow:686652e (server)' ~ Channel is unrecoverably broken and will be disposed!
05-29 20:50:11.988  1307  1848 W InputDispatcher: channel 'cee5c0f PopupWindow:1e4918 (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
05-29 20:50:11.988  1307  1848 E InputDispatcher: channel 'cee5c0f PopupWindow:1e4918 (server)' ~ Channel is unrecoverably broken and will be disposed!
05-29 20:50:11.988  1307  1848 W InputDispatcher: channel '5fe22e6 it.niedermann.owncloud.notes/it.niedermann.owncloud.notes.android.activity.EditNoteActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9```

**To Reproduce**
Steps to reproduce the behavior:
1. Open a new note.
2. Enter '# A'
3. Hold to open menu
3. 'Select All'
4. 'Cut'

**Expected behavior**
To 'Cut'
@stefan-niedermann
Copy link
Member

Thank you for catching a stack strace :)

@korelstar
Copy link
Member

This issue is already tracked in upstream from the MD-editor: yydcdut/RxMarkdown#60

@korelstar
Copy link
Member

Duplicate of #477

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants