{
contact_height = contacts.getContactHeight();
// fractional number of contacts covering each pixel
- contacts_per_pixel = ((double) contact_height) / ((double) graphHeight);
+ contacts_per_pixel = (graphHeight < 1) ? contact_height
+ : ((double) contact_height) / ((double) graphHeight);
if (contacts_per_pixel >= 1)
{