Fix Label: endless loop if not using system font, and constrained length is less than one character width

This commit is contained in:
Dhilan007 2014-10-20 10:41:01 +08:00
parent fed7787ceb
commit 0bb02fb34f
1 changed files with 7 additions and 7 deletions

View File

@ -151,16 +151,16 @@ bool LabelTextFormatter::multilineText(Label *theLabel)
else
{
StringUtils::trimUTF16Vector(last_word);
if (isStartOfLine)
//issue #8492:endless loop if not using system font, and constrained length is less than one character width
if (isStartOfLine && last_word.size() == 0)
last_word.push_back(character);
last_word.push_back('\n');
multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
last_word.clear();
if (!isStartOfLine)
else
--j;
last_word.push_back('\n');
multiline_string.insert(multiline_string.end(), last_word.begin(), last_word.end());
last_word.clear();
isStartOfWord = false;
isStartOfLine = false;
startOfWord = -1;