I know this thread is a bit old, but I recently ran into this issue in the affiliates module in WHMCS and thought I would share what I found. This problem was happening on my installation for one affiliate only as well, all the other affiliates did not throw this error. In looking at this one affiliates account I noticed that they had zero referrals, just happens to be a company we do a lot of business with and they send their client details to use via phone/email and we setup the accounts for them and mark them as the affiliate for the account - so they have never actually refered any traffic to our site using their affiliate link, i.e. http://domain.com/whmcs/*?aff=123
I resolved the divide by zero warning by pasting their affiliate link into a browser and hitting it once. This seems to be a defect in the WHMCS affiliate module code - they should be handling that condition in their code.
Hope this helps someone who may run into this in the future.