Prevent divide by zero. Issue #7100

Fix for issue #7100 
The parens are there because I just copied it.
I tried changing it, but I get some git issues with fast forwarding that I shouldn't be getting.
I suspect it's because it's been so long since I made a pull request. I know it took at least 15 min for me to upload this patch, and it required me to update a few MBs.
I don't really feel like going through that again. But if you guys really want it, I'll do it