X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbook.cpp;h=9528e47c8c9e99c383e22838371723f9e1a09e6f;hp=95ccd690506251c284dc557905a53d5c1cc6711f;hb=2e46db436965e9f3c9c24d028cc6a8bfc85303d4;hpb=efeb37c33f15a903dbe5706529a7a26511e9ca58 diff --git a/src/book.cpp b/src/book.cpp index 95ccd690..9528e47c 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -365,18 +365,20 @@ void Book::open(const string& fName) { fileName = fName; ifstream::open(fileName.c_str(), ifstream::in | ifstream::binary); - if (is_open()) - { - // Get the book size in number of entries - seekg(0, ios::end); - bookSize = long(tellg()) / EntrySize; - seekg(0, ios::beg); + // Silently return when asked to open a non-exsistent file + if (!is_open()) + return; + + // Get the book size in number of entries + seekg(0, ios::end); + bookSize = long(tellg()) / EntrySize; + seekg(0, ios::beg); - if (good()) - return; + if (!good()) + { + cerr << "Failed to open book file " << fileName << endl; + exit(EXIT_FAILURE); } - cerr << "Failed to open book file " << fileName << endl; - exit(EXIT_FAILURE); }