Merge pull request #3905 from Dhilan007/di2914

issues #2914:removeSpriteFramesFromFile() crashes if file doesn't exist
This commit is contained in:
James Chen 2013-10-09 20:14:20 -07:00
commit 96ec8d34a9
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