Currently, if you have an initialized yet empty CCDictionary and call allKeys() on it, it returns NULL. I would expect it to return an empty CCArray, but is that just me? Often I use allKeys() before iterating through the dictionary so it returning NULL means that I have to check it for NULL before my for loop.
CCDictionary *aDict = CCDictionary::create();
CCArray *allkeys = aDict->allKeys();
for (int i = 0; i < allkeys->count(); i++) { // <-- this line crashes the app because allkeys is NULL, not empty CCArray
// some code here
}
Changing this to return an empty CCArray may break some existing code, but it seems more forgiving to the programmer. Thoughts?