summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer
diff options
context:
space:
mode:
authorDane Springmeyer <dane@mapbox.com>2015-05-08 15:19:41 -0700
committerDane Springmeyer <dane@mapbox.com>2015-05-08 15:19:41 -0700
commit768c259495200ff3214dd4eb1284aaa49a7a814c (patch)
tree57253e67be6051d469d47d3daa40bd6d968ffb39 /src/mbgl/renderer
parent5ef362bbc45e7b553f5d21a5368e09dd243a8a0c (diff)
downloadqtlocation-mapboxgl-768c259495200ff3214dd4eb1284aaa49a7a814c.tar.gz
fix division by zero conditions
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r--src/mbgl/renderer/line_bucket.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp
index 651b4986e4..bbfc02ead1 100644
--- a/src/mbgl/renderer/line_bucket.cpp
+++ b/src/mbgl/renderer/line_bucket.cpp
@@ -143,7 +143,7 @@ void LineBucket::addGeometry(const std::vector<Coordinate>& vertices) {
// Find the cosine of the angle between the next and join normals
// using dot product. The inverse of that is the miter length.
const float cosHalfAngle = joinNormal.x * nextNormal.x + joinNormal.y * nextNormal.y;
- const float miterLength = 1 / cosHalfAngle;
+ const float miterLength = cosHalfAngle != 0 ? 1 / cosHalfAngle: 1;
// The join if a middle vertex, otherwise the cap
const bool middleVertex = prevVertex && nextVertex;