summaryrefslogtreecommitdiff
path: root/src/mbgl/layout
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-01-31 13:09:00 +0000
committerChris Loer <chris.loer@mapbox.com>2018-02-07 11:28:10 -0800
commit62ae0738e8a3d1b3e4b661fa7e8d8bb1d6339c51 (patch)
tree7fb66922cfbeb09522cc7ef17d61877944f956f9 /src/mbgl/layout
parent9cb4ffd24833550b8cdf8c2256e29fd92cd5d5f0 (diff)
downloadqtlocation-mapboxgl-62ae0738e8a3d1b3e4b661fa7e8d8bb1d6339c51.tar.gz
[core] Don't crash on line labels with 0 glyphs.
Fixes issue #10956.
Diffstat (limited to 'src/mbgl/layout')
-rw-r--r--src/mbgl/layout/symbol_projection.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mbgl/layout/symbol_projection.cpp b/src/mbgl/layout/symbol_projection.cpp
index ee6385c93c..9e077e2532 100644
--- a/src/mbgl/layout/symbol_projection.cpp
+++ b/src/mbgl/layout/symbol_projection.cpp
@@ -318,7 +318,7 @@ namespace mbgl {
placedGlyphs.push_back(*placedGlyph);
}
placedGlyphs.push_back(firstAndLastGlyph->second);
- } else {
+ } else if (symbol.glyphOffsets.size() == 1) {
// Only a single glyph to place
// So, determine whether to flip based on projected angle of the line segment it's on
if (keepUpright && !flip) {
@@ -337,7 +337,6 @@ namespace mbgl {
return *orientationChange;
}
}
- assert(symbol.glyphOffsets.size() == 1); // We are relying on SymbolInstance.hasText filtering out symbols without any glyphs at all
const float glyphOffsetX = symbol.glyphOffsets.front();
optional<PlacedGlyph> singleGlyph = placeGlyphAlongLine(fontScale * glyphOffsetX, lineOffsetX, lineOffsetY, flip, projectedAnchorPoint, symbol.anchorPoint, symbol.segment,
symbol.line, symbol.tileDistances, labelPlaneMatrix, false);
@@ -347,6 +346,8 @@ namespace mbgl {
placedGlyphs.push_back(*singleGlyph);
}
+ // The number of placedGlyphs must equal the number of glyphOffsets, which must correspond to the number of glyph vertices
+ // There may be 0 glyphs here, if a label consists entirely of glyphs that have 0x0 dimensions
for (auto& placedGlyph : placedGlyphs) {
addDynamicAttributes(placedGlyph.point, placedGlyph.angle, dynamicVertexArray);
}