summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/style/expression/interpolate.hpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/mbgl/style/expression/interpolate.hpp b/include/mbgl/style/expression/interpolate.hpp
index 439122f91c..fd9ec25a2c 100644
--- a/include/mbgl/style/expression/interpolate.hpp
+++ b/include/mbgl/style/expression/interpolate.hpp
@@ -11,7 +11,7 @@
#include <memory>
#include <map>
-
+#include <cmath>
namespace mbgl {
namespace style {
@@ -109,9 +109,15 @@ public:
EvaluationResult evaluate(const EvaluationContext& params) const override {
const EvaluationResult evaluatedInput = input->evaluate(params);
- if (!evaluatedInput) { return evaluatedInput.error(); }
+ if (!evaluatedInput) {
+ return evaluatedInput.error();
+ }
+
float x = *fromExpressionValue<float>(*evaluatedInput);
-
+ if (std::isnan(x)) {
+ return EvaluationError { "Input is not a number." };
+ }
+
if (stops.empty()) {
return EvaluationError { "No stops in exponential curve." };
}