Prevent division by zero

Potentially fixes https://github.com/owncloud/core/issues/11742