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

Crashing on Long press over link #9

Closed
crazyhitty opened this issue Oct 15, 2017 · 6 comments
Closed

Crashing on Long press over link #9

crazyhitty opened this issue Oct 15, 2017 · 6 comments

Comments

@crazyhitty
Copy link

Hi Saket, first of all thanks for creatng this awesome library, it makes much easier to manage links in my app.

But, I am facing this crash on long click.

FATAL EXCEPTION: main
Process: me.saket.betterlinkmovement.sample, PID: 4362
java.lang.StringIndexOutOfBoundsException: length=238; index=-1
    at java.lang.String.substring(String.java:1968)
    at android.text.SpannableStringInternal.<init>(SpannableStringInternal.java:33)
    at android.text.SpannableString.<init>(SpannableString.java:34)
    at android.text.SpannableString.subSequence(SpannableString.java:54)
    at me.saket.bettermovementmethod.BetterLinkMovementMethod$ClickableSpanWithText.ofSpan(BetterLinkMovementMethod.java:436)
    at me.saket.bettermovementmethod.BetterLinkMovementMethod.dispatchUrlLongClick(BetterLinkMovementMethod.java:395)
    at me.saket.bettermovementmethod.BetterLinkMovementMethod$1.onTimerReached(BetterLinkMovementMethod.java:232)
    at me.saket.bettermovementmethod.BetterLinkMovementMethod$LongPressTimer.run(BetterLinkMovementMethod.java:413)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Steps to reproduce:

  1. Click on a link.
  2. Long click on the same link but just on text bounds boundary.

Video:
Crash video

@crazyhitty
Copy link
Author

crazyhitty commented Oct 15, 2017

@Saketme This pull request closes this issue: #10

@saket
Copy link
Owner

saket commented Oct 16, 2017

Hey @crazyhitty, just letting you know that I'll have a look at this tomorrow. I'm traveling right now and the network here is really weak. Thanks for finding this bug though.

@bartwell
Copy link

Hi @Saketme,

This issue still exists. Could you please to fix it?

@saket
Copy link
Owner

saket commented Feb 10, 2018

@bartwell apologies for not being able to pay attention to this. I will fix this issue this week as soon as I get time.

@saket
Copy link
Owner

saket commented Feb 18, 2018

Fixed in commit 068976d. Will release a new version soon. In the meanwhile, you can get a build off HEAD using jitpack.io.

@saket
Copy link
Owner

saket commented Feb 18, 2018

@saket saket closed this as completed Feb 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants