]> git.sesse.net Git - stockfish/blobdiff - src/ucioption.cpp
Do not crash if we are asked to search mate or stalemate position.
[stockfish] / src / ucioption.cpp
index 6e727954e68095a6896a03ac3fc5f1fbc2a4db74..d1326a4c9be0b8c76f1bd86f79c5faf3d720abc3 100644 (file)
@@ -169,6 +169,18 @@ namespace {
       return ret;
   }
 
+  // Specialization for std::string where instruction 'ss >> ret;'
+  // would erroneusly tokenize a string with spaces.
+
+  template<>
+  string get_option_value<string>(const string& optionName) {
+
+      if (options.find(optionName) == options.end())
+          return string();
+
+      return options[optionName].currentValue;
+  }
+
 }
 
 ////
@@ -210,7 +222,7 @@ void print_uci_options() {
   for (Options::const_iterator it = options.begin(); it != options.end(); ++it)
       vec.push_back(it->second);
 
-  std::stable_sort(vec.begin(), vec.end());
+  std::sort(vec.begin(), vec.end());
 
   for (std::vector<Option>::const_iterator it = vec.begin(); it != vec.end(); ++it)
   {