avoid potential zero division resulting in nan in agg::gamma_linear - closes #761
This commit is contained in:
parent
94c5645e8b
commit
7e974b9064
1 changed files with 5 additions and 1 deletions
6
deps/agg/include/agg_gamma_functions.h
vendored
6
deps/agg/include/agg_gamma_functions.h
vendored
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue