Check if buffer read is complete before decoding

nit: explain why by referencing the other function?