avcodec/imgconvert: fix possible null pointer dereference