From 5966e5d6e4e7913e9740b8f79c12c065b084ddb5 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Fri, 15 Sep 2017 11:29:49 -0400 Subject: [PATCH] make reader_open() work even if idxopt is NULL --- index.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.c b/index.c index 40d111a..f772ab8 100644 --- a/index.c +++ b/index.c @@ -454,7 +454,8 @@ mm_idx_reader_t *mm_idx_reader_open(const char *fn, const mm_idxopt_t *opt, cons if (is_idx < 0) return 0; // failed to open the index r = (mm_idx_reader_t*)calloc(1, sizeof(mm_idx_reader_t)); r->is_idx = is_idx; - r->opt = *opt; + if (opt) r->opt = *opt; + else mm_idxopt_init(&r->opt); if (r->is_idx) r->fp.idx = fopen(fn, "rb"); else r->fp.seq = mm_bseq_open(fn); if (fn_out) r->fp_out = fopen(fn_out, "wb");