From 3c1df5e01d8ce5d0ef492302047d2b0628dfc6ef Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Mon, 15 Jan 2024 22:14:59 +0800 Subject: [PATCH] safely execute the callback --- src/components/EmojiPicker/EmojiPicker.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/EmojiPicker/EmojiPicker.js b/src/components/EmojiPicker/EmojiPicker.js index 71270fe26c2e..eaf89b7f64ea 100644 --- a/src/components/EmojiPicker/EmojiPicker.js +++ b/src/components/EmojiPicker/EmojiPicker.js @@ -88,7 +88,9 @@ const EmojiPicker = forwardRef((props, ref) => { } const currOnModalHide = onModalHide.current; onModalHide.current = () => { - currOnModalHide(); + if (currOnModalHide) { + currOnModalHide(); + } emojiPopoverAnchorRef.current = null; }; setIsEmojiPickerVisible(false);