X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=sam%2Ffaidx.c;fp=sam%2Ffaidx.c;h=51c82ac1dfdcd0baf31435a0fe5f8e45c3289d0f;hp=f0798fccc8057a5e33fdb04afaae1af084badbc9;hb=dbcf1cfb8ad1086c21d64e249f012809403e7ddc;hpb=58d504aaf36ae486b1dba6d03e0e9f1c25855037 diff --git a/sam/faidx.c b/sam/faidx.c index f0798fc..51c82ac 100644 --- a/sam/faidx.c +++ b/sam/faidx.c @@ -337,6 +337,11 @@ char *fai_fetch(const faidx_t *fai, const char *str, int *len) } else s[name_end] = ':', name_end = l; } } else iter = kh_get(s, h, str); + if(iter == kh_end(h)) { + fprintf(stderr, "[fai_fetch] Warning - Reference %s not found in FASTA file, returning empty sequence\n", str); + free(s); + return 0; + }; val = kh_value(h, iter); // parse the interval if (name_end < l) {