Aghajari / AXEmojiView

an advanced library which adds emoji,sticker,... support to your Android application.
Apache License 2.0
179 stars 45 forks source link

NullPointerException object Pattern #41

Open Scorpionstvo opened 1 year ago

Scorpionstvo commented 1 year ago

Hello. I save a String from AXEmojiEditText to storage when I close the fragment. When I open this fragment again, I take the value from the database and set the text to AXEmojiEditText. The error occurs when emoji are present in the saved text. The error doesn't happen every time. I initialize emojiView before the method restoreDraft. Please help me solve this problem.

 private fun restoreDraft() {
        val draft = viewModel.getChat(getParams().id)?.draftMessage
        if (draft != null) `binding.chatInput.setText(draft)
    }

java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.regex.Matcher java.util.regex.Pattern.matcher(java.lang.CharSequence)' on a null object reference