From 7f1917f166f6bc1eca879bf1b767fe5589b22c55 Mon Sep 17 00:00:00 2001 From: Nikolai Romashchenko Date: Wed, 17 Apr 2024 12:57:18 +0200 Subject: [PATCH] Fixed a crash during the second merge phase where a batch was empty --- i2l | 2 +- ipk/src/db_builder.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/i2l b/i2l index a6ef750..bb52a84 160000 --- a/i2l +++ b/i2l @@ -1 +1 @@ -Subproject commit a6ef750d334c7b08ad82a4ea5fecd6849c8a72ca +Subproject commit bb52a84f5c9cb4b52629682fead61b3c5d7bdc64 diff --git a/ipk/src/db_builder.cpp b/ipk/src/db_builder.cpp index 92a9109..9d4244a 100644 --- a/ipk/src/db_builder.cpp +++ b/ipk/src/db_builder.cpp @@ -326,7 +326,10 @@ namespace ipk std::priority_queue, std::greater<>> heap; for (const auto& batch_db : batch_dbs) { - heap.push(batch_db.kmer_order[0]); + if (!batch_db.kmer_order.empty()) + { + heap.push(batch_db.kmer_order[0]); + } } ProgressBar bar2{ @@ -438,7 +441,7 @@ namespace ipk for (size_t batch_id = 0; batch_id < _num_batches; ++batch_id) { batches.emplace_back(get_batch_db_name(batch_id)); - auto& loader = batches[batch_id]; + auto& loader= batches[batch_id]; /// pre-load the first k-mer and push the loader to the queue if (loader.has_next())