I'm adding and removing a small CCSprite over the course of the game. It works fine for the first 3 to 4 times. But after a that, it crashes. This happens when I deploy in android device. Here's some code..
CCSprite sp= CCSprite::create("ping.png");
pingList.push_back(sp); // pingList is a vector of CCSprites
//somewhere else in the code, I do,
if(pingList.at(i)!=NULL) //Passes this condition and goes inside
CCLog("ping tag %d",pingList.at(i)->getTag()); //But crashes here
Any idea what could be going wrong? Or is there any way to check during runtime if
pingList.at(i) actually holds a valid
CCNode (as opposed to some random junk value)? I can provide more code/detail if needed.
In logcat I just get this,
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 12410 (Thread-3572)