guard against division by 0

valgrind + bff

Change-Id: I5fa40f7a9759c98bb70ee6eb854dd9b376401f89
(cherry picked from commit 1ab0e8717bee9fee6c42015647bccfbf1683b8fc)
Reviewed-on: https://gerrit.libreoffice.org/11036
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>