decoder: check for 0-length buffers before attempting to decode