From ee299e355665ee5443449d5cc26ea714f19ea90e Mon Sep 17 00:00:00 2001 From: Petr Danecek Date: Wed, 31 May 2023 12:46:47 +0100 Subject: [PATCH] Provide a nill (dot) value when the field is empty Fixes https://github.com/samtools/htslib/pull/1619#issuecomment-1569914543 --- annot-tsv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/annot-tsv.c b/annot-tsv.c index ae4f8355e5..ee1a4df679 100644 --- a/annot-tsv.c +++ b/annot-tsv.c @@ -680,6 +680,8 @@ void process_line(args_t *args, char *line, size_t size) else str = args->src.hdr.cols->off[ -args->src.transfer_idx[i] - 1 ]; // non-existent field in src, use a default value + if ( !str || !*str ) str = "."; // provide a nill dot value when the field is empty + if ( !args->allow_dups ) { if ( khash_str2int_has_key(args->tmp_hash[i],str) ) continue;