Skip to content

Commit

Permalink
make AddressSanitizer happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Mar 11, 2024
1 parent c3268c7 commit 19b1869
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vcfpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1575,10 +1575,12 @@ class BcfWriter
}

/// write a string to a vcf line
void writeLine(std::string vcfline)
void writeLine(const std::string & vcfline)
{
if(!isHeaderWritten && !writeHeader()) throw std::runtime_error("could not write header\n");
kstring_t s = {vcfline.length(), vcfline.length(), &vcfline[0]}; // kstring
std::vector<char> str(vcfline.begin(), vcfline.end());
str.push_back('\0'); // don't forget string has no \0;
kstring_t s = {vcfline.length(), vcfline.length(), &str[0]}; // kstring
ret = vcf_parse(&s, header.hdr, b.get());
if(ret > 0) throw std::runtime_error("error parsing: " + vcfline + "\n");
if(b->errcode == BCF_ERR_CTG_UNDEF)
Expand Down

0 comments on commit 19b1869

Please sign in to comment.