diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index 07c1089e6..5859022b4 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -334,6 +334,8 @@ namespace libtorrent end = int(p->blocks_in_piece); } + TORRENT_ASSERT(end <= p->blocks_in_piece); + // count number of blocks that would be flushed int num_blocks = 0; for (int i = end-1; i >= 0; --i)