]> git.sesse.net Git - stockfish/commitdiff
Fix a possible out of range access in previous patch
authorMarco Costalba <mcostalba@gmail.com>
Wed, 12 May 2010 11:30:00 +0000 (12:30 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 12 May 2010 11:30:00 +0000 (12:30 +0100)
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index 4a2acb62c810684c5eabedb471473b98e86e49e2..ed15902d4838c5800b53fc32a98ae0140e890dce 100644 (file)
@@ -2409,7 +2409,7 @@ namespace {
         // If this thread is the master of a split point and all slaves have
         // finished their work at this split point, return from the idle loop.
         int i = 0;
         // If this thread is the master of a split point and all slaves have
         // finished their work at this split point, return from the idle loop.
         int i = 0;
-        for ( ; sp && !sp->slaves[i] && i < ActiveThreads; i++) {}
+        for ( ; sp && i < ActiveThreads && !sp->slaves[i]; i++) {}
 
         if (i == ActiveThreads)
         {
 
         if (i == ActiveThreads)
         {