From b05dd8729dac7187487219259f9d9ac1e425c6c8 Mon Sep 17 00:00:00 2001
From: Heng Li <lh3@live.co.uk>
Date: Sat, 10 Oct 2009 10:12:26 +0000
Subject: [PATCH]  * samtools-0.1.6-11 (r477)  * fixed a bug due to recent
 change in bam_index.c (thank Nicole Washington for the patch)

---
 bam_index.c | 1 +
 bamtk.c     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/bam_index.c b/bam_index.c
index 4606d6b..a627884 100644
--- a/bam_index.c
+++ b/bam_index.c
@@ -542,6 +542,7 @@ int bam_fetch(bamFile fp, const bam_index_t *idx, int tid, int beg, int end, voi
 {
 	int n_off;
 	pair64_t *off = get_chunk_coordinates(idx, tid, beg, end, &n_off);
+	if (off == 0) return 0;
 	{
 		// retrive alignments
 		uint64_t curr_off;
diff --git a/bamtk.c b/bamtk.c
index 042f78d..bf58871 100644
--- a/bamtk.c
+++ b/bamtk.c
@@ -9,7 +9,7 @@
 #endif
 
 #ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION "0.1.6-10 (r474)"
+#define PACKAGE_VERSION "0.1.6-11 (r477)"
 #endif
 
 int bam_taf2baf(int argc, char *argv[]);
-- 
2.39.5