File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,9 @@ std::vector<std::string> TileDBVCFDataset::get_vcf_attributes(std::string uri) {
165165
166166 // Read VCF header into string for parsing
167167 bcf_hdr_t * hdr = VCFUtils::hdr_read_header (uri);
168+ if (hdr == nullptr ) {
169+ throw std::runtime_error (" Error reading VCF header from: " + uri);
170+ }
168171 std::string hdrstr = VCFUtils::hdr_to_string (hdr);
169172 const char * p = hdrstr.c_str ();
170173
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ uint32_t VCFUtils::get_end_pos(
6262
6363bcf_hdr_t * VCFUtils::hdr_read_header (const std::string& path) {
6464 auto fh = vcf_open (path.c_str (), " r" );
65+
66+ int retries = 3 ;
67+ while (!fh && retries--) {
68+ fh = vcf_open (path.c_str (), " r" );
69+ }
70+
6571 if (!fh)
6672 return nullptr ;
6773 auto hdr = bcf_hdr_read (fh);
You can’t perform that action at this time.
0 commit comments