X-Git-Url: https://git.donarmstrong.com/?p=samtools.git;a=blobdiff_plain;f=bam_plcmd.c;h=f77be0467e6442c12145a35ebb97259e237d5625;hp=ed00d2e80202fde96d5c5aecfc28aa8ff39e5bd6;hb=307c147168f7154e3755712797078c513e0b242a;hpb=700d451b57c06a5fc842b24be0d69d4a251c91df diff --git a/bam_plcmd.c b/bam_plcmd.c index ed00d2e..f77be04 100644 --- a/bam_plcmd.c +++ b/bam_plcmd.c @@ -208,6 +208,11 @@ static int mpileup(mplp_conf_t *conf, int n, char **fn) bam_header_t *h_tmp; data[i] = calloc(1, sizeof(mplp_aux_t)); data[i]->fp = strcmp(fn[i], "-") == 0? bam_dopen(fileno(stdin), "r") : bam_open(fn[i], "r"); + if ( !data[i]->fp ) + { + fprintf(stderr, "[%s] failed to open %d-th input.\n", __func__, i+1); + exit(1); + } data[i]->conf = conf; h_tmp = bam_header_read(data[i]->fp); data[i]->h = i? h : h_tmp; // for i==0, "h" has not been set yet