summaryrefslogtreecommitdiff
path: root/src/text
diff options
context:
space:
mode:
authorDane Springmeyer <dane@mapbox.com>2014-05-30 12:41:41 -0700
committerDane Springmeyer <dane@mapbox.com>2014-05-30 12:41:41 -0700
commitd19870d9d280b1614f6bb747629652ec66cb492a (patch)
tree2f47f19d2e3be919dca6198398c0866e07f47b4c /src/text
parent552b9a0f1bc86b617fd6d8163c5164eceeb01641 (diff)
downloadqtlocation-mapboxgl-d19870d9d280b1614f6bb747629652ec66cb492a.tar.gz
fix another potential invalid memory access
Diffstat (limited to 'src/text')
-rw-r--r--src/text/glyph_store.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/text/glyph_store.cpp b/src/text/glyph_store.cpp
index 5e94a35f49..50084ba5f5 100644
--- a/src/text/glyph_store.cpp
+++ b/src/text/glyph_store.cpp
@@ -40,7 +40,10 @@ const Shaping FontStack::getShaping(const std::u32string &string, const float &m
for (uint32_t chr : string) {
shaping.emplace_back(0, chr, x, 0);
i++;
- x += metrics.find(chr)->second.advance + letterSpacing;
+ auto metric = metrics.find(chr);
+ if (metric != metrics.end()) {
+ x += metric->second.advance + letterSpacing;
+ }
}
lineWrap(shaping, lineHeight, maxWidth, alignment, verticalAlignment);