mapnik::value - return 'infinity' if rhs == 0 to avoid division by zero

This commit is contained in:
artemp 2014-05-12 10:14:10 +01:00 committed by Dane Springmeyer
parent 911993512a
commit 8c03ea3d68

View file

@ -495,6 +495,7 @@ struct div: public boost::static_visitor<V>
template <typename T>
value_type operator() (T lhs, T rhs) const
{
if (rhs == 0) return std::numeric_limits<value_type>::infinity();
return lhs / rhs;
}
@ -513,11 +514,13 @@ struct div: public boost::static_visitor<V>
value_type operator() (value_double lhs, value_integer rhs) const
{
if (rhs == 0) return std::numeric_limits<value_type>::infinity();
return lhs / rhs;
}
value_type operator() (value_integer lhs, value_double rhs) const
{
if (rhs == 0) return std::numeric_limits<value_type>::infinity();
return lhs / rhs;
}
};