]> git.sesse.net Git - stockfish/commitdiff
Clear token before reading from input
authorRodrigo Exterckötter Tjäder <rodrigo@tjader.com.br>
Sun, 16 Nov 2014 23:48:30 +0000 (07:48 +0800)
committerGary Linscott <glinscott@gmail.com>
Sun, 16 Nov 2014 23:48:30 +0000 (07:48 +0800)
Previously token would keep its value from the previous line when an empty
line was input, leading to unexpected behaviour.

No functional change

Resolves #119

src/uci.cpp

index ee1b07023a5fe97b17a8c28cb8911fd9caaefc73..0f67c4401fd6a0b53fef53a27118e63dc0ff626e 100644 (file)
@@ -157,6 +157,7 @@ void UCI::loop(int argc, char* argv[]) {
 
       istringstream is(cmd);
 
 
       istringstream is(cmd);
 
+      token.clear(); // getline() could return empty or blank line
       is >> skipws >> token;
 
       if (token == "quit" || token == "stop" || token == "ponderhit")
       is >> skipws >> token;
 
       if (token == "quit" || token == "stop" || token == "ponderhit")