Fix segfault in empty buffers.