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