diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index ad0fb2d71..2af5278f5 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -49,12 +49,15 @@ bool TileParser::obsolete() const { return tile.state == TileData::State::obsole void TileParser::addGlyph(uint64_t tileid, const std::string stackname, const std::u32string &string, const FontStack &fontStack, GlyphAtlas &glyphAtlas, GlyphPositions &face) { - std::map sdfs = fontStack.getSDFs(); + const std::map &sdfs = fontStack.getSDFs(); // Loop through all characters and add glyph to atlas, positions. for (uint32_t chr : string) { - const SDFGlyph sdf = sdfs[chr]; - const Rect rect = glyphAtlas.addGlyph(tileid, stackname, sdf); - face.emplace(chr, Glyph{rect, sdf.metrics}); + auto sdf_it = sdfs.find(chr); + if (sdf_it != sdfs.end()) { + const SDFGlyph& sdf = sdf_it->second; + const Rect rect = glyphAtlas.addGlyph(tileid, stackname, sdf); + face.emplace(chr, Glyph{rect, sdf.metrics}); + } } }