summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2020-04-03 12:21:45 +0300
committerzmiao <miao.zhao@mapbox.com>2020-04-03 12:32:58 +0300
commit982d36584205d97da75b48b582a52be39d9f03cb (patch)
tree30a06ba1d2cfc39bf4d23df74a5319362c157822
parent2ba4f9c84abcfb58eda064b937d14cbeb0773dbf (diff)
downloadqtlocation-mapboxgl-982d36584205d97da75b48b582a52be39d9f03cb.tar.gz
[build] Fix division by zero error
-rw-r--r--src/mbgl/style/expression/compound_expression.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp
index d1722b071f..bae0258aa0 100644
--- a/src/mbgl/style/expression/compound_expression.cpp
+++ b/src/mbgl/style/expression/compound_expression.cpp
@@ -502,7 +502,9 @@ const auto& divideCompoundExpression() {
static auto signature = detail::makeSignature("/", [](double a, double b) -> Result<double> {
if (b == 0) {
if (a == 0) return std::numeric_limits<double>::quiet_NaN();
- return std::numeric_limits<double>::infinity();
+ double inf = std::numeric_limits<double>::infinity();
+ if (a > 0) return inf;
+ if (a < 0) return -inf;
}
return a / b;
});