Assert Error :CCArrayAppendObject line:120

Assert Error :ccArray.cpp function:ccArrayAppendObject line:120

this is the error when i am trying to execute a frame animation using this code :

`CCArray *frames= CCArray::create();

for(int i=0 ; i<=21 ; i++)
{
    CCString *frame=CCString::createWithFormat("mypong%04d.png",i);
    frames->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frame->getCString()));
}
sprite->runAction(CCAnimate::create(CCAnimation::create(frames,.01)));

}`

its under TouchesBegan method.Anyone knows what i am doing wrong here ??

If i comment this code out everything works perfect…

NOTE: i am on win7 64-bit ,cocos2dx 2.0.1, ndk r8b

Try

CCArray * frames = CCArray::create(0;
frames -> retain()

for ( int i = 0; i < 21; i++ ) {
   // some code
}

// some code

frames -> release();

okay the problem was that my spritesheet got corrupted or something weird happened with it…it does not contain images from frame 10 to 15 …dont know what happened to it…there are five black images in the spritesheet