From c50fd68f6f1eec78d0c8b2558093ad6305f862b3 Mon Sep 17 00:00:00 2001 From: Derek Date: Wed, 4 Aug 2010 16:03:07 -0400 Subject: [PATCH] Bug fix in BamReader::Jump() --- BamReader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.39.5