diff --git a/chain.c b/chain.c index 4947a3e..d8c1eae 100644 --- a/chain.c +++ b/chain.c @@ -28,6 +28,7 @@ mm128_t *mm_chain_dp(int max_dist_x, int max_dist_y, int bw, int max_skip, int m mm128_t *b, *w; if (_u) *_u = 0, *n_u_ = 0; + if (n == 0 || a == 0) return 0; f = (int32_t*)kmalloc(km, n * 4); p = (int32_t*)kmalloc(km, n * 4); t = (int32_t*)kmalloc(km, n * 4); diff --git a/hit.c b/hit.c index 92aa6b7..f43b0d6 100644 --- a/hit.c +++ b/hit.c @@ -449,6 +449,7 @@ void mm_set_mapq(void *km, int n_regs, mm_reg1_t *regs, int min_chain_sc, int ma int64_t sum_sc = 0; float uniq_ratio; int i; + if (n_regs == 0) return; for (i = 0; i < n_regs; ++i) if (regs[i].parent == regs[i].id) sum_sc += regs[i].score; diff --git a/main.c b/main.c index 798f6d7..970884e 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "ketopt.h" -#define MM_VERSION "2.15-r913-dirty" +#define MM_VERSION "2.15-r914-dirty" #ifdef __linux__ #include