From 097d4f3266d2c51c98a0333aa3cd3748c64424b4 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 21 Jan 2015 14:15:30 +0800 Subject: [PATCH] check if plist file exist --- cocos/2d/CCSpriteFrameCache.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index a8c4679c96..00b9eb40af 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -235,10 +235,18 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, const s void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist) { CCASSERT(plist.size()>0, "plist filename should not be nullptr"); + + std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist); + if (fullPath.size() == 0) + { + // return if plist file doesn't exist + CCLOG("cocos2d: SpriteFrameCache: can not find %s", plist.c_str()); + return; + } if (_loadedFileNames->find(plist) == _loadedFileNames->end()) { - std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); string texturePath("");