X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam_index.c;h=9b71bdbac9167ec38719be411ee6d42a276c927f;hb=4d48006473298b62ee54f13d706f9f2e512e02bd;hp=c65d512320289a98c8bd6c75ecbe0ddebded2bc1;hpb=80658e4d152b53bd55927c432ceece7702ab49d7;p=samtools.git diff --git a/bam_index.c b/bam_index.c index c65d512..9b71bdb 100644 --- a/bam_index.c +++ b/bam_index.c @@ -179,11 +179,11 @@ bam_index_t *bam_index_core(bamFile fp) if (last_tid < c->tid) { // change of chromosomes last_tid = c->tid; last_bin = 0xffffffffu; - } else if (last_tid > c->tid) { + } else if ((uint32_t)last_tid > (uint32_t)c->tid) { fprintf(stderr, "[bam_index_core] the alignment is not sorted (%s): %d-th chr > %d-th chr\n", bam1_qname(b), last_tid+1, c->tid+1); return NULL; - } else if (last_coor > c->pos) { + } else if ((int32_t)c->tid >= 0 && last_coor > c->pos) { fprintf(stderr, "[bam_index_core] the alignment is not sorted (%s): %u > %u in %d-th chr\n", bam1_qname(b), last_coor, c->pos, c->tid+1); return NULL;