Wierd no one thought to check if the vector wasnt empty before running that delete state...
do delete code stuff
It sounds like its trying to access a element that doesnt exist, and it never hurts ( at least I dont think it does ) to check if a container is empty before doing stuff.
But if the vector is empty the for loop wont run at all if i understand it right. And the code works now(same that i posted), i guess i had sloppy code somewhere else.