]> git.donarmstrong.com Git - bamtools.git/commitdiff
In standard indexed BAM files with with sparce coverage (our test case was a roughly...
authorgabeiscoding <gaberudy@gmail.com>
Fri, 23 Sep 2011 15:35:34 +0000 (09:35 -0600)
committergabeiscoding <gaberudy@gmail.com>
Fri, 23 Sep 2011 15:35:34 +0000 (09:35 -0600)
Without this bail out, we would get a crash. Returning false silently is the preferred behavior in our view as it allows our read logic to go to the next query and does not add noise to stderr.

src/api/internal/BamStandardIndex_p.cpp

index b92c47b287c0b10a13ed1309131188bba2f5b5ef..11f570ae6b6c087ea2073a8477b55374792d4100 100644 (file)
@@ -434,6 +434,12 @@ bool BamStandardIndex::GetOffset(const BamRegion& region, int64_t& offset, bool*
         return false;
     }
 
+    // if not candidate offsets are present in the indexed (most likely sparce coverage)
+    // then silently bail
+    if( offsets.size() == 0 ) {
+        return false;
+    }
+    
     // ensure that offsets are sorted before processing
     sort( offsets.begin(), offsets.end() );