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

Avoid division by zero report by static analyzer.