avcodec/pnm: check buf[0] before using buf[1]

Fixes CSA warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>