]> git.donarmstrong.com Git - bamtools.git/commitdiff
Merge pull request #16 from gabeiscoding/patch-2
authorDerek Barnett <derekwbarnett@gmail.com>
Tue, 27 Sep 2011 04:10:59 +0000 (21:10 -0700)
committerDerek Barnett <derekwbarnett@gmail.com>
Tue, 27 Sep 2011 04:10:59 +0000 (21:10 -0700)
Fixed: Crash in BamStandardIndex::GetOffset for small BAM files

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() );