Author Topic: UILabel bug GetUrlByCharacterIndex  (Read 3154 times)

bowragon

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
UILabel bug GetUrlByCharacterIndex
« on: July 25, 2014, 10:40:04 AM »
Hey,

I am not sure if this is fixed already, but I just found a bug under UILabel's GetUrlByCharacterIndex method.

It lacked another check for ending the url bbcode, the [/url] part. So if you click on any words that come after an already enclosed url, it will always return the url instead of null.

This is my solution to the problem:
int urlEnd = mText.IndexOf("[/url]", linkStart);
    if (characterIndex > linkStart &&
        characterIndex < urlEnd)

I just ran a little test and it solved pretty well, but I'm not sure if this is the best solution.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel bug GetUrlByCharacterIndex
« Reply #1 on: July 26, 2014, 03:12:41 AM »
Thanks! I've examined the code on my end and indeed it wasn't capping it properly as you've pointed out. I've fixed that issue, and in the process found another small one that I've also fixed.