Properly handle scenario where emoji mark cannot be found #685

This commit is contained in:
Ben Gotow 2018-02-14 14:00:46 -08:00
parent ba505ac66e
commit f74236ec03

View file

@ -69,11 +69,12 @@ function FloatingEmojiPicker({ value, onChange }) {
let emoji = null;
try {
emoji = value.marks.find(i => i.type === EMOJI_TYPING_TYPE);
if (!emoji) return false;
} catch (err) {
// sometimes fails for some reason
}
if (!emoji) return false;
const picked = emoji.data.get('picked');
const suggestions = emoji.data.get('suggestions');
if (!suggestions || !suggestions.length) return false;