fix divide by zero error

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
Merge pull request #4328 from vieux/fix_4298

fix divide by zero error