Skip to content

Commit 23b45d5

Browse files
committed
Merge pull request cocos2d#1252 from csaftoiu/patch-2
Infinite loop bug
2 parents ce72f22 + 6ac2782 commit 23b45d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cocos2d/label_nodes/CCLabelTTF.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,9 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{
682682
break;
683683
}
684684
} while (tempLineWidth > locDimensionsWidth);
685+
if (cutoff === -1) {
686+
break;
687+
}
685688
var newline = strings[i].substr(cutoff + 1);
686689
strings.splice(i + 1, 0, newline);
687690
strings[i] = str;

0 commit comments

Comments
 (0)