Skip to content

Commit

Permalink
Fill in cr->rg when writing CRAM v1
Browse files Browse the repository at this point in the history
As per the other branches of the if-else, set cr->rg.
Also rewrite the assert: the previous code produced "brg is unused"
warnings when compiled with -DNDEBUG.
  • Loading branch information
jmarshall authored and jkbonfield committed Nov 2, 2021
1 parent 7060387 commit f674651
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cram/cram_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3057,7 +3057,8 @@ static int process_one_read(cram_fd *fd, cram_container *c,
cr->rg = brg ? brg->id : -1;
} else if (CRAM_MAJOR_VERS(fd->version) == 1) {
sam_hrec_rg_t *brg = sam_hrecs_find_rg(fd->header->hrecs, "UNKNOWN");
assert(brg);
if (!brg) goto block_err;
cr->rg = brg->id;
} else {
cr->rg = -1;
}
Expand Down

0 comments on commit f674651

Please sign in to comment.