From 8f1459771738302a2fd6fe504ee0dfc76b3c4551 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Sat, 19 Apr 2014 09:38:45 -0700 Subject: [PATCH] check if _currentUTF16String is null --- cocos/2d/CCFontAtlas.cpp | 2 +- cocos/2d/CCLabel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index fff6d1ae94..9ac4761537 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -221,7 +221,7 @@ bool FontAtlas::getLetterDefinitionForChar(unsigned short letteCharUTF16, FontL bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String) { FontFreeType* fontTTf = dynamic_cast(_font); - if(fontTTf == nullptr) + if(fontTTf == nullptr || utf16String == nullptr) return false; int length = cc_wcslen(utf16String); diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 58acf58a79..15138037c1 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -571,7 +571,7 @@ float Label::getScaleX() const void Label::alignText() { - if (_fontAtlas == nullptr) + if (_fontAtlas == nullptr || _currentUTF16String == nullptr) { return; }