Skip to content

Commit

Permalink
Allow a "remove tag" operation followed by an "add the same tag" oper…
Browse files Browse the repository at this point in the history
…ation. Fixes samtools/bcftools#1408
  • Loading branch information
pd3 committed Feb 16, 2021
1 parent 550c6b1 commit 04fc3d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vcf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4165,7 +4165,7 @@ int bcf_update_info(const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const v
if ( inf )
{
// Is it big enough to accommodate new block?
if ( str.l <= inf->vptr_len + inf->vptr_off )
if ( inf->vptr && str.l <= inf->vptr_len + inf->vptr_off )
{
if ( str.l != inf->vptr_len + inf->vptr_off ) line->d.shared_dirty |= BCF1_DIRTY_INF;
uint8_t *ptr = inf->vptr - inf->vptr_off;
Expand Down Expand Up @@ -4322,7 +4322,7 @@ int bcf_update_format(const bcf_hdr_t *hdr, bcf1_t *line, const char *key, const
else
{
// The tag is already present, check if it is big enough to accommodate the new block
if ( str.l <= fmt->p_len + fmt->p_off )
if ( fmt->p && str.l <= fmt->p_len + fmt->p_off )
{
// good, the block is big enough
if ( str.l != fmt->p_len + fmt->p_off ) line->d.indiv_dirty = 1;
Expand Down

0 comments on commit 04fc3d0

Please sign in to comment.