fix crash: divide by zero when computing avg color
put averageColor init closer to where it is used
Merge pull request #3317 from AndrewMeadows/inertia

fix for crash when computing average image color