diff --git a/cocos/2d/platform/CCFileUtils.cpp b/cocos/2d/platform/CCFileUtils.cpp index 3404675922..1434eea8e6 100644 --- a/cocos/2d/platform/CCFileUtils.cpp +++ b/cocos/2d/platform/CCFileUtils.cpp @@ -547,6 +547,8 @@ static Data getData(const std::string& filename, bool forString) std::string FileUtils::getStringFromFile(const std::string& filename) { Data data = getData(filename, true); + if (! data.getBytes()) + return ""; std::string ret((const char*)data.getBytes()); return ret; }