Prevent division by zero

Potentially fixes https://github.com/owncloud/core/issues/11742
Merge pull request #11754 from owncloud/fix-division-null

Prevent division by zero