diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-04-18 17:44:24 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@gmail.com> | 2018-04-18 17:44:24 -0700 |
commit | edabf8e221cf37ca9abcb5879f3d9eed6625b333 (patch) | |
tree | d94ff2a15352f2a846bc70eed87a54b6730e0acf /src/mbgl/layout/symbol_projection.cpp | |
parent | 29e23cf08b4315cfa0777c6962f06376e2bdee60 (diff) | |
download | qtlocation-mapboxgl-edabf8e221cf37ca9abcb5879f3d9eed6625b333.tar.gz |
Don't crash on placing symbols with 0 renderable glyphsupstream/cloer-11729
Fixes issue #11729. Close relative of issue #10956.
It is possible for us to receive Glyphs from the server that are valid, but have an invalid bitmap. In that case, the glyphs will be present in the `GlyphMap` used for shaping, but not present in the `GlyphPositions` used in `getGlyphQuads`. `SymbolInstance::hasText` looked at the shaping instead of the actual quads.
`symbol_projection.cpp` should never try to project a label without any quads, but we'll also try to make it so that it doesn't crash if it does.
Diffstat (limited to 'src/mbgl/layout/symbol_projection.cpp')
-rw-r--r-- | src/mbgl/layout/symbol_projection.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mbgl/layout/symbol_projection.cpp b/src/mbgl/layout/symbol_projection.cpp index 9e077e2532..ef669c6e19 100644 --- a/src/mbgl/layout/symbol_projection.cpp +++ b/src/mbgl/layout/symbol_projection.cpp @@ -240,7 +240,11 @@ namespace mbgl { const PlacedSymbol& symbol, const mat4& labelPlaneMatrix, const bool returnTileDistance) { - + if (symbol.glyphOffsets.empty()) { + assert(false); + return optional<std::pair<PlacedGlyph, PlacedGlyph>>(); + } + const float firstGlyphOffset = symbol.glyphOffsets.front(); const float lastGlyphOffset = symbol.glyphOffsets.back();; |