From: derek Date: Fri, 3 Dec 2010 20:45:20 +0000 (-0500) Subject: Fixed: bug in the BamReader::Jump() codepath, specifically the X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4782d394d544d459fe7badd5f803490f0a48f8c3;p=bamtools.git Fixed: bug in the BamReader::Jump() codepath, specifically the BRP::AdjustRegion() logic --- 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;