diff --git a/src/amrfinder/amrfinder.cpp b/src/amrfinder/amrfinder.cpp index 023141a..34d0dac 100644 --- a/src/amrfinder/amrfinder.cpp +++ b/src/amrfinder/amrfinder.cpp @@ -330,7 +330,9 @@ process_chrom(const bool verbose, const uint32_t n_threads, const auto n_blocks = n_threads*blocks_per_thread; - const size_t lim = n_cpgs - window_size + 1; + const size_t lim = (n_cpgs >= window_size) ? + n_cpgs - window_size + 1 : 0; + ; const auto blocks = get_block_bounds(static_cast(0), lim, lim/n_blocks);