Prevent a possible division by zero. it fixes #3212