issues #2914:removeSpriteFramesFromFile() crashes if file doesn't exist

This commit is contained in:
Dhilan007 2013-10-10 10:28:49 +08:00
parent 16fec3386b
commit a17f141e7d
1 changed files with 5 additions and 1 deletions

View File

@ -344,7 +344,11 @@ void SpriteFrameCache::removeSpriteFramesFromFile(const char* plist)
{
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist);
Dictionary* dict = Dictionary::createWithContentsOfFileThreadSafe(fullPath.c_str());
if (dict == nullptr)
{
CCLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFile: create dict by %s fail.",plist);
return;
}
removeSpriteFramesFromDictionary((Dictionary*)dict);
// remove it from the cache