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: IndexOutOfBoundsException in Hinter.unhighlight #364

Open
TWiStErRob opened this issue Nov 30, 2023 · 3 comments
Open

Crash: IndexOutOfBoundsException in Hinter.unhighlight #364

TWiStErRob opened this issue Nov 30, 2023 · 3 comments
Labels
a:bug something isn't working as expected via:Console http://play.google.com/console/developers/7995455198986011414/app/4974852622245161228/vitals/crashes
Milestone

Comments

@TWiStErRob
Copy link
Owner

TWiStErRob commented Nov 30, 2023

Version: 12001279 (1.2.0#1279-8eca619)

  • samsung dm3q (Galaxy S23 Ultra) Android 13 (SDK 33) 1 user, 5 times
Exception java.lang.IndexOutOfBoundsException:
  at android.text.SpannableStringBuilder.charAt (SpannableStringBuilder.java:126)
  at android.text.CharSequenceCharacterIterator.current (CharSequenceCharacterIterator.java:58)
  at android.text.CharSequenceCharacterIterator.setIndex (CharSequenceCharacterIterator.java:83)
  at android.icu.text.RuleBasedBreakIterator.CISetIndex32 (RuleBasedBreakIterator.java:1055)
  at android.icu.text.RuleBasedBreakIterator.isBoundary (RuleBasedBreakIterator.java:549)
  at android.text.method.WordIterator.isBoundary (WordIterator.java:102)
  at android.widget.Editor$SelectionHandleView.positionAtCursorOffset (Editor.java:7885)
  at android.widget.Editor$HandleView.invalidate (Editor.java:5998)
  at android.widget.Editor$SelectionModifierCursorController.invalidateHandles (Editor.java:8845)
  at android.widget.Editor.invalidateHandlesAndActionMode (Editor.java:2527)
  at android.widget.TextView.spanChange (TextView.java:12114)
  at android.widget.TextView$ChangeWatcher.onSpanRemoved (TextView.java:15309)
  at android.text.SpannableStringBuilder.sendSpanRemoved (SpannableStringBuilder.java:1310)
  at android.text.SpannableStringBuilder.removeSpan (SpannableStringBuilder.java:515)
  at android.text.SpannableStringBuilder.removeSpan (SpannableStringBuilder.java:815)
  at android.text.SpannableStringBuilder.removeSpan (SpannableStringBuilder.java:803)
  at androidx.emoji2.text.SpannableBuilder.removeSpan (SpannableBuilder.java:179)
  at net.twisterrob.inventory.android.content.model.helpers.Hinter.unhighlight (Hinter.java:56)
  at net.twisterrob.inventory.android.fragment.data.BaseEditFragment.updateHint (BaseEditFragment.java:298)
  at net.twisterrob.inventory.android.fragment.data.BaseEditFragment.access$600 (BaseEditFragment.java:57)
  at net.twisterrob.inventory.android.fragment.data.BaseEditFragment$6.onTextChanged (BaseEditFragment.java:209)
  at android.widget.TextView.sendOnTextChanged (TextView.java:11881)
  at android.widget.TextView.handleTextChanged (TextView.java:12010)
  at android.widget.TextView$ChangeWatcher.onTextChanged (TextView.java:15271)
  at android.text.SpannableStringBuilder.sendTextChanged (SpannableStringBuilder.java:1281)
  at android.text.SpannableStringBuilder.replace (SpannableStringBuilder.java:590)
  at androidx.emoji2.text.SpannableBuilder.replace (SpannableBuilder.java:315)
  at android.text.SpannableStringBuilder.delete (SpannableStringBuilder.java:232)
  at androidx.emoji2.text.SpannableBuilder.delete (SpannableBuilder.java:337)
  at androidx.emoji2.text.SpannableBuilder.delete (SpannableBuilder.java:49)
  at android.widget.TextView.deleteText_internal (TextView.java:14763)
  at android.widget.TextView.onTextContextMenuItem (TextView.java:13880)
  at androidx.appcompat.widget.AppCompatEditText.onTextContextMenuItem (AppCompatEditText.java:367)
  at android.widget.Editor$TextActionModeCallback.onActionItemClicked (Editor.java:5371)
  at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onActionItemClicked (DecorView.java:5691)
  at com.android.internal.view.FloatingActionMode$3.onMenuItemSelected (FloatingActionMode.java:97)
  at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected (MenuBuilder.java:788)
  at com.android.internal.view.menu.MenuItemImpl.invoke (MenuItemImpl.java:160)
  at com.android.internal.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:935)
  at com.android.internal.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:925)
  at com.android.internal.view.FloatingActionMode.lambda$setFloatingToolbar$0$com-android-internal-view-FloatingActionMode (FloatingActionMode.java:128)
  at com.android.internal.view.FloatingActionMode$$ExternalSyntheticLambda0.onMenuItemClick
  at com.android.internal.widget.floatingtoolbar.LocalFloatingToolbarPopup$2.onClick (LocalFloatingToolbarPopup.java:203)
  at android.view.View.performClick (View.java:7892)
  at android.view.View.performClickInternal (View.java:7869)
  at android.view.View.-$$Nest$mperformClickInternal
  at android.view.View$PerformClick.run (View.java:30891)
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8762)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
  • samsung r9q (Galaxy S21 FE 5G) Android 14 (SDK 34) May 6 1 user 1 times
Exception java.lang.IndexOutOfBoundsException: charAt: 21 >= length 21
  at android.text.SpannableStringBuilder.charAt (SpannableStringBuilder.java:125)
  at android.text.CharSequenceCharacterIterator.current (CharSequenceCharacterIterator.java:58)
  at android.text.CharSequenceCharacterIterator.setIndex (CharSequenceCharacterIterator.java:83)
  at android.icu.text.RuleBasedBreakIterator.CISetIndex32 (RuleBasedBreakIterator.java:1055)
  at android.icu.text.RuleBasedBreakIterator.isBoundary (RuleBasedBreakIterator.java:549)
  at android.text.method.WordIterator.isBoundary (WordIterator.java:112)
  at android.widget.Editor$SelectionHandleView.positionAtCursorOffset (Editor.java:8032)
  at android.widget.Editor$HandleView.invalidate (Editor.java:6125)
  at android.widget.Editor$SelectionModifierCursorController.invalidateHandles (Editor.java:9000)
  at android.widget.Editor.invalidateHandlesAndActionMode (Editor.java:2574)
  at android.widget.TextView.spanChange (TextView.java:13244)
  at android.widget.TextView$ChangeWatcher.onSpanRemoved (TextView.java:16817)
  at android.text.SpannableStringBuilder.sendSpanRemoved (SpannableStringBuilder.java:1297)
  at android.text.SpannableStringBuilder.removeSpan (SpannableStringBuilder.java:502)
  at android.text.SpannableStringBuilder.removeSpan (SpannableStringBuilder.java:802)
  at android.text.SpannableStringBuilder.removeSpan (SpannableStringBuilder.java:790)
  at androidx.emoji2.text.SpannableBuilder.removeSpan (SpannableBuilder.java:179)
  at net.twisterrob.inventory.android.content.model.helpers.Hinter.unhighlight (Hinter.java:56)
  at net.twisterrob.inventory.android.fragment.data.BaseEditFragment.updateHint (BaseEditFragment.java:298)
  at net.twisterrob.inventory.android.fragment.data.BaseEditFragment.access$600 (BaseEditFragment.java:57)
  at net.twisterrob.inventory.android.fragment.data.BaseEditFragment$6.onTextChanged (BaseEditFragment.java:209)
  at android.widget.TextView.sendOnTextChanged (TextView.java:13007)
  at android.widget.TextView.handleTextChanged (TextView.java:13136)
  at android.widget.TextView$ChangeWatcher.onTextChanged (TextView.java:16779)
  at android.text.SpannableStringBuilder.sendTextChanged (SpannableStringBuilder.java:1268)
  at android.text.SpannableStringBuilder.replace (SpannableStringBuilder.java:577)
  at androidx.emoji2.text.SpannableBuilder.replace (SpannableBuilder.java:315)
  at android.text.SpannableStringBuilder.delete (SpannableStringBuilder.java:231)
  at androidx.emoji2.text.SpannableBuilder.delete (SpannableBuilder.java:337)
  at androidx.emoji2.text.SpannableBuilder.delete (SpannableBuilder.java:49)
  at android.widget.TextView.deleteText_internal (TextView.java:16270)
  at android.widget.TextView.onTextContextMenuItem (TextView.java:15351)
  at android.widget.EditText.onTextContextMenuItem (EditText.java:252)
  at androidx.appcompat.widget.AppCompatEditText.onTextContextMenuItem (AppCompatEditText.java:367)
  at android.widget.Editor$TextActionModeCallback.onActionItemClicked (Editor.java:5592)
  at com.android.internal.policy.DecorView$ActionModeCallback2Wrapper.onActionItemClicked (DecorView.java:3791)
  at com.android.internal.view.FloatingActionMode$3.onMenuItemSelected (FloatingActionMode.java:97)
  at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected (MenuBuilder.java:788)
  at com.android.internal.view.menu.MenuItemImpl.invoke (MenuItemImpl.java:160)
  at com.android.internal.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:935)
  at com.android.internal.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:925)
  at com.android.internal.view.FloatingActionMode.lambda$setFloatingToolbar$0 (FloatingActionMode.java:128)
  at com.android.internal.view.FloatingActionMode.$r8$lambda$GLgk8deM4E5TWGJBQ3xBpWWp_5A
  at com.android.internal.view.FloatingActionMode$$ExternalSyntheticLambda0.onMenuItemClick
  at com.android.internal.widget.floatingtoolbar.LocalFloatingToolbarPopup$2.onClick (LocalFloatingToolbarPopup.java:202)
  at android.view.View.performClick (View.java:8043)
  at android.view.View.performClickInternal (View.java:8020)
  at android.view.View.-$$Nest$mperformClickInternal
  at android.view.View$PerformClick.run (View.java:31850)
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8893)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:608)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
@TWiStErRob TWiStErRob added a:bug something isn't working as expected via:Console http://play.google.com/console/developers/7995455198986011414/app/4974852622245161228/vitals/crashes labels Nov 30, 2023
@TWiStErRob TWiStErRob added this to the v1.2.1 milestone Nov 30, 2023
@TWiStErRob
Copy link
Owner Author

Tried to reproduce by interacting with the emulator's text selection popup, but no luck.

I compared the stack, and the only "destructive" action I have is "Paste", using that triggers a different code path:

image

"Cut" doesn't even call unhighlight, because the "title validation" stops it (empty => error state)

@TWiStErRob
Copy link
Owner Author

deleteText_internal is only used in "Cut":
image

Selecting the the last 3 characters of a 4-letter word and cutting it reproduced the issue.

@TWiStErRob
Copy link
Owner Author

TWiStErRob commented May 25, 2024

Repro:

  1. Set Highlight matches in Settings
  2. Create new item
  3. Enter "abcd"
  4. Select "cd"
  5. Cut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug something isn't working as expected via:Console http://play.google.com/console/developers/7995455198986011414/app/4974852622245161228/vitals/crashes
Projects
None yet
Development

No branches or pull requests

1 participant