avcodec/jpeg2000dec: fix near null pointer dereference

Fixes Ticket2840

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