From 712b1c4f12a69e77e2735563b6fd3f8ac8d2aefd Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Wed, 6 Jun 2018 12:40:26 +0200 Subject: [PATCH] make skin variation parsing more resilient --- src/providers/emoji/emojis.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/providers/emoji/emojis.cpp b/src/providers/emoji/emojis.cpp index 612e0268a..910142cdc 100644 --- a/src/providers/emoji/emojis.cpp +++ b/src/providers/emoji/emojis.cpp @@ -127,8 +127,14 @@ void Emojis::loadEmojis() auto variationEmojiData = std::make_shared(); + auto toneNameIt = toneNames.find(tone); + if (toneNameIt == toneNames.end()) { + debug::Log("Tone with key {} does not exist in tone names map", tone); + continue; + } + parseEmoji(variationEmojiData, variation, - emojiData->shortCode + "_" + toneNames[tone]); + emojiData->shortCode + "_" + toneNameIt->second); this->emojiShortCodeToEmoji.insert(variationEmojiData->shortCode, variationEmojiData);