]> git.sesse.net Git - remoteglot-book/commitdiff
Treat 0-length moves as not having a move.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Dec 2014 20:57:14 +0000 (21:57 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Dec 2014 20:57:19 +0000 (21:57 +0100)
binloader.cpp

index acf14d7c9d3dd79d0bf436c4ab4c772f3540a889..730f59279eba946af8073826b08cf775564cf994 100644 (file)
@@ -98,7 +98,7 @@ void write_subshard(const char *basename, ShardData* shard, int bucket)
                        c.set_pgn_file_num(e.file_num);
                        c.set_pgn_start_position(e.start_position);
                }
-               if (!moves.count(e.move)) {
+               if (strlen(e.move) > 0 && !moves.count(e.move)) {
                        moves.insert(e.move);
                        c.add_move(e.move);
                }
@@ -214,7 +214,9 @@ int main(int argc, char **argv)
                //              exit(1);
                                break;
                        }
-                       if (fread(&move[0], l, 1, fp) != 1) {
+                       if (l == 0) {
+                               move[0] = 0;
+                       } else if (fread(&move[0], l, 1, fp) != 1) {
                                perror("fread()");
                //              exit(1);
                                break;