samtools/bcftools — pull request #168 by travc (2014-12-02 19:33:57+00:00)
Title: Minor fix/workaround for some Number=R format fields

FORMAT/DPR has a length of 2 when ALT == '.' (second value is 0).
I'm unsure if that is a bug in samtools mpileup or allowed by the VCF v4.2 spec.

Anyway, it is easy to to do a workaround.

You might want to add a check to ensure that the actual value of the second element is '.' or '0' (as noted in the comment). I don't know the structs well enough off to do that off the top of my head.

PS: (apologies in advance for being pedantic)
You really should get into the habit of always enclosing conditionally executed code (after 'if' or 'else' at least) in curly-braces.