codec.chunk: Use the maybe monad

Instead of guarding against nil in various distant parts of the
decoding process, use the maybe monad during message deserialization.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>