mirror of https://github.com/axmolengine/axmol.git
fix bugs in CCDictionary::objectForKey(int/string)
This commit is contained in:
parent
16afe5b616
commit
f1b87ef0e9
|
@ -93,10 +93,11 @@ CCObject* CCDictionary::objectForKey(const std::string& key)
|
|||
{
|
||||
if (m_eDictType != kCCDictStr)
|
||||
{
|
||||
CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key.");
|
||||
|
||||
CCObject* pRetObject = NULL;
|
||||
CCDictElement *pElement = NULL;
|
||||
HASH_FIND_STR(m_pElements, key.c_str(), pElement);
|
||||
|
@ -111,10 +112,11 @@ CCObject* CCDictionary::objectForKey(int key)
|
|||
{
|
||||
if (m_eDictType != kCCDictInt)
|
||||
{
|
||||
CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key.");
|
||||
|
||||
CCObject* pRetObject = NULL;
|
||||
CCDictElement *pElement = NULL;
|
||||
HASH_FIND_INT(m_pElements, &key, pElement);
|
||||
|
|
Loading…
Reference in New Issue