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

Crash when cutting title #477

Closed
Keho opened this issue Sep 15, 2018 · 8 comments
Closed

Crash when cutting title #477

Keho opened this issue Sep 15, 2018 · 8 comments

Comments

@Keho
Copy link

Keho commented Sep 15, 2018

Hi,

  1. Create a new note with the following text:
    # Test
  2. Select either everything or everything but the number sign (the space must be selected).
  3. Press "Cut". The app should crash.

Nextcloud Notes 0.22
AnysoftKeyboard 1.9.2055
LineageOS 15.1 Android 8.1.0

Crashes on olders version of the app too (down to 0.14.2 at least, didn't try earlier than that).

@stefan-niedermann
Copy link
Member

Not reproducable by me. (pretty much the same setting).

Can you share the exact note content and the category and if it is marked as favorite, so i can set up the exact same environement?

@Keho
Copy link
Author

Keho commented Sep 16, 2018

The exact note is just # Test
Tried with no category and different categories and it crashes each time.
It also crashes whether the note is marked as favorite or not.

@korelstar
Copy link
Member

Can't reproduce, too.

@stefan-niedermann
Copy link
Member

I have been able to reproduce the issue on my physical device. I will try to investigate the behavior.

@stefan-niedermann
Copy link
Member

09-16 13:51:08.566 27494-27494/it.niedermann.owncloud.notes E/AndroidRuntime: FATAL EXCEPTION: main
    Process: it.niedermann.owncloud.notes, PID: 27494
    java.lang.IndexOutOfBoundsException: charAt: 2 >= length 2
        at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:123)
        at android.text.CharSequenceCharacterIterator.next(CharSequenceCharacterIterator.java:67)
        at android.icu.text.RuleBasedBreakIterator.handleNext(RuleBasedBreakIterator.java:1311)
        at android.icu.text.RuleBasedBreakIterator.next(RuleBasedBreakIterator.java:416)
        at android.icu.text.RuleBasedBreakIterator.rulesFollowing(RuleBasedBreakIterator.java:742)
        at android.icu.text.RuleBasedBreakIterator.following(RuleBasedBreakIterator.java:696)
        at android.icu.text.RuleBasedBreakIterator.isBoundary(RuleBasedBreakIterator.java:932)
        at android.text.method.WordIterator.isBoundary(WordIterator.java:95)
        at android.widget.Editor$SelectionHandleView.positionAtCursorOffset(Editor.java:5005)
        at android.widget.Editor$HandleView.invalidate(Editor.java:4298)
        at android.widget.Editor$SelectionModifierCursorController.invalidateHandles(Editor.java:5660)
        at android.widget.Editor.invalidateHandlesAndActionMode(Editor.java:1863)
        at android.widget.TextView.spanChange(TextView.java:9526)
        at android.widget.TextView$ChangeWatcher.onSpanRemoved(TextView.java:11965)
        at android.text.SpannableStringBuilder.sendSpanRemoved(SpannableStringBuilder.java:1281)
        at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:499)
        at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:788)
        at com.yydcdut.markdown.utils.SyntaxUtils.removeSpans(SyntaxUtils.java:294)
        at com.yydcdut.markdown.live.HeaderLive.format(HeaderLive.java:90)
        at com.yydcdut.markdown.live.HeaderLive.onTextChanged(HeaderLive.java:63)
        at com.yydcdut.markdown.live.LivePrepare.onTextChanged(LivePrepare.java:81)
        at com.yydcdut.markdown.MarkdownEditText.onTextChanged4Controller(MarkdownEditText.java:252)
        at com.yydcdut.markdown.MarkdownEditText.access$700(MarkdownEditText.java:44)
        at com.yydcdut.markdown.MarkdownEditText$EditTextWatcher.onTextChanged(MarkdownEditText.java:176)
        at android.widget.TextView.sendOnTextChanged(TextView.java:9364)
        at android.widget.TextView.handleTextChanged(TextView.java:9451)
        at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:11926)
        at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:1252)
        at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:573)
        at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:229)
        at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:227)
        at android.widget.TextView.deleteText_internal(TextView.java:11434)
        at android.widget.TextView.onTextContextMenuItem(TextView.java:10846)
        at android.widget.Editor$TextActionModeCallback.onActionItemClicked(Editor.java:3976)
        at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onActionItemClicked(DecorView.java:2459)
        at com.android.internal.view.FloatingActionMode$3.onMenuItemSelected(FloatingActionMode.java:96)
        at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:761)
        at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:167)
        at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:908)
        at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:898)
        at com.android.internal.view.FloatingActionMode.lambda$-com_android_internal_view_FloatingActionMode_4856(FloatingActionMode.java:121)
        at com.android.internal.view.-$Lambda$IoKM3AcgDw3Ok5aFi0zlym2p3IA.$m$0(Unknown Source:4)
        at com.android.internal.view.-$Lambda$IoKM3AcgDw3Ok5aFi0zlym2p3IA.onMenuItemClick(Unknown Source:0)
        at com.android.internal.widget.FloatingToolbar$FloatingToolbarPopup$2.onClick(FloatingToolbar.java:425)
        at android.view.View.performClick(View.java:6294)
        at android.view.View$PerformClick.run(View.java:24770)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@stefan-niedermann
Copy link
Member

yydcdut/RxMarkdown#60

@sn0n
Copy link

sn0n commented Jul 21, 2019

Is there any path forward without that RxMarkdown bug being fixed?

Here's another chunk to use....

java.lang.IndexOutOfBoundsException: charAt: 0 >= length 0
	at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:124)
	at android.text.CharSequenceCharacterIterator.current(CharSequenceCharacterIterator.java:58)
	at android.text.CharSequenceCharacterIterator.first(CharSequenceCharacterIterator.java:44)
	at android.icu.text.RuleBasedBreakIterator.CISetIndex32(RuleBasedBreakIterator.java:1046)
	at android.icu.text.RuleBasedBreakIterator.isBoundary(RuleBasedBreakIterator.java:500)
	at android.text.method.WordIterator.isBoundary(WordIterator.java:101)
	at android.widget.Editor$SelectionHandleView.positionAtCursorOffset(Editor.java:5555)
	at android.widget.Editor$HandleView.invalidate(Editor.java:4609)
	at android.widget.Editor$SelectionModifierCursorController.invalidateHandles(Editor.java:6244)
	at android.widget.Editor.invalidateHandlesAndActionMode(Editor.java:2006)
	at android.widget.TextView.spanChange(TextView.java:10692)
	at android.widget.TextView$ChangeWatcher.onSpanRemoved(TextView.java:13406)
	at android.text.SpannableStringBuilder.sendSpanRemoved(SpannableStringBuilder.java:1296)
	at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:501)
	at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:801)
	at android.text.SpannableStringBuilder.removeSpan(SpannableStringBuilder.java:789)
	at com.yydcdut.markdown.utils.SyntaxUtils.removeSpans(SyntaxUtils.java:294)
	at com.yydcdut.markdown.live.HeaderLive.format(HeaderLive.java:90)
	at com.yydcdut.markdown.live.HeaderLive.onTextChanged(HeaderLive.java:63)
	at com.yydcdut.markdown.live.LivePrepare.onTextChanged(LivePrepare.java:81)
	at com.yydcdut.markdown.MarkdownEditText.onTextChanged4Controller(MarkdownEditText.java:252)
	at com.yydcdut.markdown.MarkdownEditText.access$700(MarkdownEditText.java:44)
	at com.yydcdut.markdown.MarkdownEditText$EditTextWatcher.onTextChanged(MarkdownEditText.java:176)
	at android.widget.TextView.sendOnTextChanged(TextView.java:10527)
	at android.widget.TextView.handleTextChanged(TextView.java:10617)
	at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:13367)
	at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:1267)
	at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:576)
	at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:230)
	at android.text.SpannableStringBuilder.delete(SpannableStringBuilder.java:37)
	at android.widget.TextView.deleteText_internal(TextView.java:12873)
	at android.widget.TextView.onTextContextMenuItem(TextView.java:12130)
	at android.widget.Editor$TextActionModeCallback.onActionItemClicked(Editor.java:4203)
	at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onActionItemClicked(DecorView.java:2539)
	at com.android.internal.view.FloatingActionMode$3.onMenuItemSelected(FloatingActionMode.java:98)
	at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:787)
	at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:151)
	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:934)
	at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:924)
	at com.android.internal.view.FloatingActionMode.lambda$setFloatingToolbar$0$FloatingActionMode(FloatingActionMode.java:123)
	at com.android.internal.view.-$$Lambda$FloatingActionMode$LU5MpPuKYDtwlFAuYhXYfzgLNLE.onMenuItemClick(Unknown Source:2)
	at com.android.internal.widget.FloatingToolbar$FloatingToolbarPopup$2.onClick(FloatingToolbar.java:442)
	at android.view.View.performClick(View.java:7125)
	at android.view.View.performClickInternal(View.java:7102)
	at android.view.View.access$3500(View.java:801)
	at android.view.View$PerformClick.run(View.java:27336)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loop(Looper.java:214)
	at android.app.ActivityThread.main(ActivityThread.java:7343)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:933)

stefan-niedermann added a commit that referenced this issue Dec 16, 2019
stefan-niedermann added a commit that referenced this issue Dec 16, 2019
stefan-niedermann added a commit that referenced this issue Dec 20, 2019
* Workaround for #477 and #604

* Workaround for #477 and #604

* [tx-robot] updated from transifex

* [tx-robot] updated from transifex

* Bump butterknife from 10.2.0 to 10.2.1

Bumps [butterknife](https://github.com/JakeWharton/butterknife) from 10.2.0 to 10.2.1.
- [Release notes](https://github.com/JakeWharton/butterknife/releases)
- [Changelog](https://github.com/JakeWharton/butterknife/blob/master/CHANGELOG.md)
- [Commits](JakeWharton/butterknife@10.2.0...10.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump butterknife-compiler from 10.2.0 to 10.2.1

Bumps [butterknife-compiler](https://github.com/JakeWharton/butterknife) from 10.2.0 to 10.2.1.
- [Release notes](https://github.com/JakeWharton/butterknife/releases)
- [Changelog](https://github.com/JakeWharton/butterknife/blob/master/CHANGELOG.md)
- [Commits](JakeWharton/butterknife@10.2.0...10.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: Nextcloud Bot <bot@nextcloud.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
@stefan-niedermann
Copy link
Member

Please have a look at #622.

TL;DR: I think i might have found a workaround which prevents the actual crash, but a complete fix is not possible for us until we have found and implemented another markdown rendering library.

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

4 participants