fdo#81284 Don't write to zero length files

Change-Id: I4eddcda3977f43b39abdaa8d9089ff661092361c
Reviewed-on: https://gerrit.libreoffice.org/10310
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>