Avoid division by zero report by static analyzer.
Merge pull request #5315 from ktf/fix-division-by-zero

Avoid division by zero report by static analyzer.