diff --git a/HelloLua/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java b/HelloLua/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java index 5946e8f72b..894b64416c 100644 --- a/HelloLua/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java +++ b/HelloLua/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java @@ -22,6 +22,11 @@ public class Cocos2dxBitmap{ public static void createTextBitmap(String content, String fontName, int fontSize, int alignment){ + // avoid error when content is "" + if (content.compareTo("") == 0){ + content = " "; + } + Paint paint = newPaint(fontName, fontSize, alignment); TextProperty textProperty = getTextWidthAndHeight(content, paint); diff --git a/HelloWorld/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java b/HelloWorld/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java index 5946e8f72b..894b64416c 100644 --- a/HelloWorld/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java +++ b/HelloWorld/android/src/org/cocos2dx/lib/Cocos2dxBitmap.java @@ -22,6 +22,11 @@ public class Cocos2dxBitmap{ public static void createTextBitmap(String content, String fontName, int fontSize, int alignment){ + // avoid error when content is "" + if (content.compareTo("") == 0){ + content = " "; + } + Paint paint = newPaint(fontName, fontSize, alignment); TextProperty textProperty = getTextWidthAndHeight(content, paint); diff --git a/tests/test.android/src/org/cocos2dx/lib/Cocos2dxBitmap.java b/tests/test.android/src/org/cocos2dx/lib/Cocos2dxBitmap.java index 5946e8f72b..894b64416c 100644 --- a/tests/test.android/src/org/cocos2dx/lib/Cocos2dxBitmap.java +++ b/tests/test.android/src/org/cocos2dx/lib/Cocos2dxBitmap.java @@ -22,6 +22,11 @@ public class Cocos2dxBitmap{ public static void createTextBitmap(String content, String fontName, int fontSize, int alignment){ + // avoid error when content is "" + if (content.compareTo("") == 0){ + content = " "; + } + Paint paint = newPaint(fontName, fontSize, alignment); TextProperty textProperty = getTextWidthAndHeight(content, paint); diff --git a/tests/tests/ParallaxTest/ParallaxTest.cpp b/tests/tests/ParallaxTest/ParallaxTest.cpp index 2b29d4b2d0..11210018c1 100644 --- a/tests/tests/ParallaxTest/ParallaxTest.cpp +++ b/tests/tests/ParallaxTest/ParallaxTest.cpp @@ -72,7 +72,7 @@ Parallax1::Parallax1() std::string Parallax1::title() { - return "MotionStreak test (tap screen)"; + return "Parallax: parent and 3 children"; } //------------------------------------------------------------------