diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-07-13 16:57:31 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-07-13 17:57:36 +0200 |
commit | 13d6920661432afcbfbd6c956708964efc366dae (patch) | |
tree | 1e4b1c54743187cd1a95115ccc64b827a1878bf7 | |
parent | 86682f2507a9ce4b3101a8287f5e7e1bf53d0ca1 (diff) | |
download | qtlocation-mapboxgl-13d6920661432afcbfbd6c956708964efc366dae.tar.gz |
[core] fix division by zero when defaultFadeDuration is 0
-rw-r--r-- | src/mbgl/renderer/cross_faded_property_evaluator.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mbgl/renderer/cross_faded_property_evaluator.cpp b/src/mbgl/renderer/cross_faded_property_evaluator.cpp index ee3c86614f..4dff9dbf12 100644 --- a/src/mbgl/renderer/cross_faded_property_evaluator.cpp +++ b/src/mbgl/renderer/cross_faded_property_evaluator.cpp @@ -27,7 +27,10 @@ Faded<T> CrossFadedPropertyEvaluator<T>::calculate(const T& min, const T& mid, c const float z = parameters.z; const float fraction = z - std::floor(z); const std::chrono::duration<float> d = parameters.defaultFadeDuration; - const float t = std::min((parameters.now - parameters.zoomHistory.lastIntegerZoomTime) / d, 1.0f); + const float t = + d != std::chrono::duration<float>::zero() + ? std::min((parameters.now - parameters.zoomHistory.lastIntegerZoomTime) / d, 1.0f) + : 1.0f; return z > parameters.zoomHistory.lastIntegerZoom ? Faded<T> { min, mid, 2.0f, 1.0f, fraction + (1.0f - fraction) * t } |