From b0aed4c2a564db20bd4f038f8193df08179a35d0 Mon Sep 17 00:00:00 2001 From: walaj Date: Thu, 15 Feb 2018 20:02:28 -0500 Subject: [PATCH] Fix for issue #23 --- SeqLib/BamReader.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SeqLib/BamReader.h b/SeqLib/BamReader.h index 74f20afde..eb69d809c 100644 --- a/SeqLib/BamReader.h +++ b/SeqLib/BamReader.h @@ -59,8 +59,14 @@ namespace SeqLib { // close this bam bool close() { + if (!fp) return false; + + // close the cram reference + if (fp->fp.cram) + cram_close(fp->fp.cram); + fp.reset(); idx.reset(); hts_itr.reset();