Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: bowragon on July 25, 2014, 10:40:04 AM

Title: UILabel bug GetUrlByCharacterIndex
Post by: bowragon 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.
Title: Re: UILabel bug GetUrlByCharacterIndex
Post by: ArenMook 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.