Merge pull request #13044 from fusijie/fix_10763

set minimum display length to 1.
This commit is contained in:
子龙山人 2015-07-28 09:52:45 +08:00
commit 96007b2793
1 changed files with 2 additions and 0 deletions

View File

@ -283,6 +283,8 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo
std::string curText = text;
size_t stringLength = StringUtils::getCharacterCountInUTF8String(text);
int leftLength = stringLength * (1.0f - overstepPercent);
//The minimum cut length is 1, otherwise will cause the infinite loop.
if (0 == leftLength) leftLength = 1;
std::string leftWords = Helper::getSubStringOfUTF8String(curText,0,leftLength);
std::string cutWords = Helper::getSubStringOfUTF8String(curText, leftLength, stringLength - leftLength);
if (leftLength > 0)