mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-18 14:47:46 +01:00
Added a try-catch to not crash on de-emojifying
This commit is contained in:
parent
2e5a5f125a
commit
054c9722a7
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2018 Andreas Shimokawa, Matthieu Baerts
|
||||
/* Copyright (C) 2019 Andreas Shimokawa, Matthieu Baerts, Taavi Eomäe
|
||||
|
||||
This file is part of Gadgetbridge.
|
||||
|
||||
@ -19,10 +19,14 @@ package nodomain.freeyourgadget.gadgetbridge.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.wax911.emojify.EmojiManager;
|
||||
import io.wax911.emojify.EmojiUtils;
|
||||
|
||||
public class EmojiConverter {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EmojiConverter.class);
|
||||
|
||||
private static final String[][] simpleEmojiMapping = {
|
||||
{"\uD83D\uDE00", ":-D"}, // grinning
|
||||
@ -80,8 +84,12 @@ public class EmojiConverter {
|
||||
|
||||
private static String convertAdvancedEmojiToAscii(String text, Context context) {
|
||||
initEmojiData(context);
|
||||
|
||||
return EmojiUtils.shortCodify(text);
|
||||
try {
|
||||
return EmojiUtils.shortCodify(text);
|
||||
} catch (Exception e){
|
||||
LOG.warn("An exception occured when converting advanced emoji to ASCII", text);
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
public static String convertUnicodeEmojiToAscii(String text, Context context) {
|
||||
|
Loading…
Reference in New Issue
Block a user