From: Derek Date: Wed, 4 Aug 2010 20:03:07 +0000 (-0400) Subject: Bug fix in BamReader::Jump() X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c50fd68f6f1eec78d0c8b2558093ad6305f862b3;p=bamtools.git Bug fix in BamReader::Jump() --- diff --git a/BamReader.cpp b/BamReader.cpp index be6b72b..b1b1b5d 100644 --- a/BamReader.cpp +++ b/BamReader.cpp @@ -540,8 +540,10 @@ bool BamReader::BamReaderPrivate::Jump(int refID, int position) { // if this alignment corresponds to desired position // return success of seeking back to 'current offset' - if ( (bAlignment.RefID == refID && bAlignment.Position + bAlignment.Length > position) || (bAlignment.RefID > refID) ) + if ( (bAlignment.RefID == refID && bAlignment.Position + bAlignment.Length > position) || (bAlignment.RefID > refID) ) { + if ( o != offsets.begin() ) --o; return mBGZF.Seek(*o); + } } return result;