diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2016-03-29 00:23:16 -0700 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2016-03-29 11:38:35 -0700 |
commit | 0539f7b4cb49e0690b9654f57fe9e2f724e14903 (patch) | |
tree | 4feea6aee5ab1c4879d8dda9ff0623f5c8dd90cc /src/mbgl/text/get_anchors.cpp | |
parent | 6fcc7ba513753d71dc70aa219311570c2350f9e0 (diff) | |
download | qtlocation-mapboxgl-0539f7b4cb49e0690b9654f57fe9e2f724e14903.tar.gz |
[core] fix infinite loop in mbgl::resample
fix #4416
Diffstat (limited to 'src/mbgl/text/get_anchors.cpp')
-rw-r--r-- | src/mbgl/text/get_anchors.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mbgl/text/get_anchors.cpp b/src/mbgl/text/get_anchors.cpp index 740ec288b3..c55f238e52 100644 --- a/src/mbgl/text/get_anchors.cpp +++ b/src/mbgl/text/get_anchors.cpp @@ -3,6 +3,7 @@ #include <mbgl/util/constants.hpp> #include <mbgl/util/interpolate.hpp> +#include <cassert> #include <cmath> namespace mbgl { @@ -21,6 +22,8 @@ Anchors resample(const GeometryCoordinates &line, const float offset, const floa Anchors anchors; + assert(spacing > 0.0); + int i = 0; for (auto it = line.begin(), end = line.end() - 1; it != end; it++, i++) { const GeometryCoordinate &a = *(it); |