]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/BamStandardIndex_p.cpp
Fixed typo in error messages
[bamtools.git] / src / api / internal / BamStandardIndex_p.cpp
index 6d8273e9c1477a965aebb0bea553026014c90d4a..43f12ebf8838ce505180e11891e749c5313fcfd4 100644 (file)
@@ -1,7 +1,6 @@
 // ***************************************************************************
 // BamStandardIndex.cpp (c) 2010 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
-// All rights reserved.
 // ---------------------------------------------------------------------------
 // Last modified: 24 June 2011 (DB)
 // ---------------------------------------------------------------------------
@@ -264,7 +263,7 @@ bool BamStandardIndex::Create(void) {
     // open new index file (read & write)
     string indexFilename = m_reader->Filename() + Extension();
     if ( !OpenFile(indexFilename, "w+b") ) {
-        cerr << "BamStandardIndex ERROR: could not open ouput index file: " << indexFilename
+        cerr << "BamStandardIndex ERROR: could not open output index file: " << indexFilename
              << ", aborting index creation" << endl;
         return false;
     }
@@ -435,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() );