From 4782d394d544d459fe7badd5f803490f0a48f8c3 Mon Sep 17 00:00:00 2001 From: derek Date: Fri, 3 Dec 2010 15:45:20 -0500 Subject: [PATCH] Fixed: bug in the BamReader::Jump() codepath, specifically the BRP::AdjustRegion() logic --- src/api/internal/BamReader_p.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/internal/BamReader_p.cpp b/src/api/internal/BamReader_p.cpp index bffbfba..f7ab548 100644 --- a/src/api/internal/BamReader_p.cpp +++ b/src/api/internal/BamReader_p.cpp @@ -52,7 +52,9 @@ void BamReaderPrivate::AdjustRegion(BamRegion& region) { // see if any references in region have alignments HasAlignmentsInRegion = false; int currentId = region.LeftRefID; - while ( currentId <= region.RightRefID ) { + + const int rightBoundRefId = ( region.isRightBoundSpecified() ? region.RightRefID : References.size() - 1 ); + while ( currentId <= rightBoundRefId ) { HasAlignmentsInRegion = Index->HasAlignments(currentId); if ( HasAlignmentsInRegion ) break; ++currentId; -- 2.39.5