From 98e2e59e5e963dbc5451a19233d942b429a74855 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 11 Apr 2017 20:31:18 +0300 Subject: [core] Safeguard PositionedIcon usage via optional --- src/mbgl/text/shaping.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/mbgl/text/shaping.cpp') diff --git a/src/mbgl/text/shaping.cpp b/src/mbgl/text/shaping.cpp index aa760ea4fe..5fae03b4c7 100644 --- a/src/mbgl/text/shaping.cpp +++ b/src/mbgl/text/shaping.cpp @@ -10,7 +10,11 @@ namespace mbgl { -PositionedIcon shapeIcon(const SpriteAtlasElement& image, const std::array& iconOffset, const float iconRotation) { +optional PositionedIcon::shapeIcon(const SpriteAtlasElement& image, const std::array& iconOffset, const float iconRotation) { + if (!image.pos.hasArea()) { + return {}; + } + float dx = iconOffset[0]; float dy = iconOffset[1]; float x1 = dx - image.width/ 2.0f; @@ -18,7 +22,7 @@ PositionedIcon shapeIcon(const SpriteAtlasElement& image, const std::array