From 0a03af4ee961033279043b1d04b7867b9a4149d8 Mon Sep 17 00:00:00 2001 From: Jared Simpson Date: Thu, 12 Aug 2021 14:14:52 -0400 Subject: [PATCH] fix segfault when the VCF contains no records --- artic/vcfCheck.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/artic/vcfCheck.cpp b/artic/vcfCheck.cpp index a25d5f4..4f3f3f3 100644 --- a/artic/vcfCheck.cpp +++ b/artic/vcfCheck.cpp @@ -229,8 +229,10 @@ void artic::VcfChecker::Run() _getRecordStats(); } - // get stats from final record - _getRecordStats(); + // get stats from final record, if there was one + if(_numValid > 0) { + _getRecordStats(); + } // write the stats to the report file std::ofstream outputReport; @@ -255,4 +257,4 @@ unsigned int artic::VcfChecker::GetNumInPrimerSite(void) const { return _numPrim unsigned int artic::VcfChecker::GetNumInOverlap(void) const { return _numAmpOverlap; } // GetNumLowQual returns the number of records with low quality. -unsigned int artic::VcfChecker::GetNumLowQual(void) const { return _numLowQual; } \ No newline at end of file +unsigned int artic::VcfChecker::GetNumLowQual(void) const { return _numLowQual; }