Skip to content

Commit

Permalink
Fixed a crash during the second merge phase where a batch was empty
Browse files Browse the repository at this point in the history
  • Loading branch information
nromashchenko committed Apr 17, 2024
1 parent 32a1262 commit 7f1917f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion i2l
7 changes: 5 additions & 2 deletions ipk/src/db_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ namespace ipk
std::priority_queue<kmer_fv, std::vector<kmer_fv>, 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{
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 7f1917f

Please sign in to comment.