X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Flisp%2Flexer.cpp;h=166d655221cb012052ce984c6a24e726429187c2;hb=50c73400fc84693668173ce680e9d51570e616f1;hp=99ffa8151da3220f6c82a82bc4a28ce5c92201ed;hpb=a8057c3d1726484928a3091fdd5c7a3d810f5f63;p=supertux.git diff --git a/src/lisp/lexer.cpp b/src/lisp/lexer.cpp index 99ffa8151..166d65522 100644 --- a/src/lisp/lexer.cpp +++ b/src/lisp/lexer.cpp @@ -30,6 +30,7 @@ Lexer::Lexer(std::istream& newstream) : bufend(), bufpos(), c(), + token_string(), token_length() { // trigger a refill of the buffer @@ -45,7 +46,7 @@ Lexer::~Lexer() void Lexer::nextChar() { - if(bufpos >= bufend) { + if(bufpos >= bufend || (bufpos == NULL && bufend == NULL) /* Initial refill trigger */) { if(eof) { c = EOF; return; @@ -65,6 +66,10 @@ Lexer::nextChar() ++bufend; } } + + if(bufpos == NULL) + return; + c = *bufpos++; if(c == '\n') ++linenumber;