]> git.donarmstrong.com Git - samtools.git/blobdiff - bam_plcmd.c
* samtools-0.1.3-13 (r260)
[samtools.git] / bam_plcmd.c
index 23e0dd00a5eda44bbc337a17b1692adc1ecb3b8c..7bc422f508b36e13cc2a0405ac11c986357349f6 100644 (file)
@@ -304,8 +304,8 @@ int bam_pileup(int argc, char *argv[])
        {
                samfile_t *fp;
                fp = fn_list? samopen(argv[optind], "r", fn_list) : samopen(argv[optind], "rb", 0);
-               if (fp->header == 0) {
-                       fprintf(stderr, "[bam_pileup] fail to read the BAM header. Abort!\n");
+               if (fp == 0 || fp->header == 0) {
+                       fprintf(stderr, "[bam_pileup] fail to read the header: non-exisiting file or wrong format.\n");
                        return 1;
                }
                d->h = fp->header;