Skip to content

Commit 6ac2782

Browse files
committed
Infinite loop bug
This caused an infinite loop when I had a string along the lines of something like " Next ". This is the simple fix.
1 parent efef0b2 commit 6ac2782

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)