diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-07-14 12:00:53 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-07-17 15:02:47 +0200 |
commit | 6b954677c0e57b1c1b8201210aa31d956d79c9f3 (patch) | |
tree | a905382ef450ffb7a33000f11c55e74c20bd0e7d /src/mbgl/text/collision_feature.cpp | |
parent | fef873f68f6cbe7970d0530b6927ed743495af75 (diff) | |
download | qtlocation-mapboxgl-6b954677c0e57b1c1b8201210aa31d956d79c9f3.tar.gz |
[core] fix undefined behavior for division through 0
Diffstat (limited to 'src/mbgl/text/collision_feature.cpp')
-rw-r--r-- | src/mbgl/text/collision_feature.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mbgl/text/collision_feature.cpp b/src/mbgl/text/collision_feature.cpp index 022ee50644..3eb08da8d1 100644 --- a/src/mbgl/text/collision_feature.cpp +++ b/src/mbgl/text/collision_feature.cpp @@ -135,7 +135,7 @@ void CollisionFeature::bboxifyLabel(const GeometryCoordinates& line, GeometryCoo // This makes our calculation spot-on at scale=2, and on the conservative side for // lower scales const float distanceToInnerEdge = std::max(std::fabs(boxDistanceToAnchor - firstBoxOffset) - step / 2, 0.0f); - float maxScale = labelLength / 2 / distanceToInnerEdge; + float maxScale = util::division(labelLength / 2, distanceToInnerEdge, std::numeric_limits<float>::infinity()); // The box maxScale calculations are designed to be conservative on collisions in the scale range // [1,2]. At scale=1, each box has 50% overlap, and at scale=2, the boxes are lined up edge |