From: Steinar H. Gunderson Date: Mon, 15 Dec 2014 20:57:14 +0000 (+0100) Subject: Treat 0-length moves as not having a move. X-Git-Url: https://git.sesse.net/?p=remoteglot-book;a=commitdiff_plain;h=f3225963af3ef8bf33b49d5b51a37d36f47e1482 Treat 0-length moves as not having a move. --- diff --git a/binloader.cpp b/binloader.cpp index acf14d7..730f592 100644 --- a/binloader.cpp +++ b/binloader.cpp @@ -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;