Prevent writing zero-length buffers

Causes an issue with ZLib, where attempting to write nothing is an error
(as progress cannot be made).