]> git.donarmstrong.com Git - bamtools.git/commitdiff
Fixed: bug in the BamReader::Jump() codepath, specifically the
authorderek <derekwbarnett@gmail.com>
Fri, 3 Dec 2010 20:45:20 +0000 (15:45 -0500)
committerderek <derekwbarnett@gmail.com>
Fri, 3 Dec 2010 20:45:20 +0000 (15:45 -0500)
BRP::AdjustRegion() logic

src/api/internal/BamReader_p.cpp

index bffbfba04f5d2c238208d951b558e20e1e7326a6..f7ab548cc85eebfa25641dda92d47a4b336b674e 100644 (file)
@@ -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;