diff --git a/deps/agg/include/agg_gamma_functions.h b/deps/agg/include/agg_gamma_functions.h index 571c6ee11..323b80a95 100644 --- a/deps/agg/include/agg_gamma_functions.h +++ b/deps/agg/include/agg_gamma_functions.h @@ -85,7 +85,11 @@ namespace agg { if(x < m_start) return 0.0; if(x > m_end) return 1.0; - return (x - m_start) / (m_end - m_start); + double delta = m_end - m_start; + // avoid nan from potential zero division + // https://github.com/mapnik/mapnik/issues/761 + if (delta <= 0.0) return 0.0; + return (x - m_start) / delta; } private: