   Gaaah! Index out of bounds?! Why?
  I'm working on a quick-and-dirty debug console for my pet engine/software engineering testbed and for some rather peculiar reason std::string::at() keeps throwing out-of-bounds excpetions in this little code segment. Would anyone have any tips or help in determining where the problem is? I suspect it's in the delimiting conditional, but some debug work by me yielded that temp always shows up as a whitespace even when the character it *should* be isn't. I can confirm that the passed-in command string is valid.GMForceInline SupernaturalString ParseCommandLine(SupernaturalString cmdString) // tokenizes a string and executes the associated commands{// TODO: Do some search optimization, maybe figure out a means of generating a 'position' value for the std::map opsSupernaturalString cmd;bool keepGoing = true;CVarDBIter iter;size_t i = 0;do{char temp = cmd.at(i);if((temp != '\n') && (temp != ' ')){std::cout << temp << std::endl;cmd.push_back(temp);std::cout << cmd;++i;}else{keepGoing = false;break;}} while(keepGoing);iter = mappedVars.find(cmd);if(iter != mappedVars.end()){return mappedVars[cmd].AsString();}return string("Unknown variable " + cmdString);}And on a side note, if anyone has any useful articles or design advice for debug consoles as a whole I'd love to get my hands on 'em :)   
  Well the obvious reason would be if the string doesn't contain a '\n' or a ' '.   ;Quote:Original post by SiCraneWell the obvious reason would be if the string doesn't contain a '\n' or a ' '.Quote:I can confirm that the passed-in command string is valid.I did think of that one, but I also would agree that the problem is probably something really stupidly simple XD   ;  What is a "SupernaturalString" and why are you checking a locally created string rather than the parameter string? which is empty and causing the error.   ;Quote:Original post by CmpDevWhat is a "SupernaturalString" and why are you checking a locally created string rather than the parameter string? which is empty and causing the error.I knew it was stupid. Thanks!(That's my string wrapper and extension class, created mostly for portability)   