-
Corrupted STL vector?
Ok, so this is my problem: Yesterday, my code was working perfectly, if slowly. Today, my code isn't. It crashes for no reason that I can see. This is the function:
PHP Code:
void Alien::handleShots(GFX& gfx)
{
for(int i = 0; i < shots.size(); ++i)
{
if(!shots[i]->move()) //Crashes here
{
delete shots[i];
shots.erase(&shots[i]);
}
else
shots[i]->draw(gfx);
}
}
I found out that it crashed before it got into the move() function, and then I found out that whenever it crashed, it was because the vector was empty but size() returned a 10-digit number! Is my vector class corrupted or something?
P.S. I haven't changed my code since yesterday.
-
NVM, the problem had nothing to do with that, even though it crashed on that particular line (dunno why, the problem was totally unrelated).