Fixed g++ warning
[SXSI/TextCollection.git] / incbwt / bits / bitbuffer.h
index cd9e2ef..7daf60b 100644 (file)
@@ -51,7 +51,11 @@ class ReadBuffer
       this->size = bitsToWords(this->items * this->item_bits);
       usint* buffer = new usint[this->size];
       memset(buffer, 0, this->size * sizeof(usint));
-      fread(buffer, sizeof(usint), this->size, file);
+      if (fread(buffer, sizeof(usint), this->size, file) != this->size)
+      {
+          std::cerr << "ReadBuffer constructor: Unable to read file" << std::endl;
+          std::exit(1);
+      }
       this->data = buffer;
       this->reset();
     }