I don't understand the code at that location, but it can raise a division by zero in testing environment where no real graph was accessible because it couldn't be downloaded.
Just copying it over, not pluginizing it yet.