From 3e056df520676cfa7b16f1a22d0a1aae6e741e89 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sun, 21 Mar 2021 15:12:12 -0400 Subject: [PATCH] bypass the error so it doesn't crash --- .../java/awais/instagrabber/customviews/emoji/Emoji.java | 3 ++- .../instagrabber/customviews/emoji/EmojiCategory.java | 9 +++++++++ .../java/awais/instagrabber/utils/emoji/EmojiParser.java | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/customviews/emoji/Emoji.java b/app/src/main/java/awais/instagrabber/customviews/emoji/Emoji.java index d90c4d8e..2ce07a6e 100644 --- a/app/src/main/java/awais/instagrabber/customviews/emoji/Emoji.java +++ b/app/src/main/java/awais/instagrabber/customviews/emoji/Emoji.java @@ -35,7 +35,7 @@ public class Emoji { } public GoogleCompatEmojiDrawable getDrawable() { - if (drawable == null) { + if (drawable == null && unicode != null) { drawable = new GoogleCompatEmojiDrawable(unicode); } return drawable; @@ -60,6 +60,7 @@ public class Emoji { return "Emoji{" + "unicode='" + unicode + '\'' + ", name='" + name + '\'' + + ", variants=" + variants + '}'; } } diff --git a/app/src/main/java/awais/instagrabber/customviews/emoji/EmojiCategory.java b/app/src/main/java/awais/instagrabber/customviews/emoji/EmojiCategory.java index 4a621db0..8147a3aa 100644 --- a/app/src/main/java/awais/instagrabber/customviews/emoji/EmojiCategory.java +++ b/app/src/main/java/awais/instagrabber/customviews/emoji/EmojiCategory.java @@ -18,6 +18,10 @@ public class EmojiCategory { this.type = type; } + public EmojiCategory() { + this.type = null; + } + public EmojiCategoryType getType() { return type; } @@ -73,4 +77,9 @@ public class EmojiCategory { public int hashCode() { return Objects.hash(type); } + + @Override + public String toString() { + return "EmojiCategory {TYPE=" + type + ", EMOJIS=" + emojis + "}"; + } } diff --git a/app/src/main/java/awais/instagrabber/utils/emoji/EmojiParser.java b/app/src/main/java/awais/instagrabber/utils/emoji/EmojiParser.java index 09a67225..dc29f12b 100644 --- a/app/src/main/java/awais/instagrabber/utils/emoji/EmojiParser.java +++ b/app/src/main/java/awais/instagrabber/utils/emoji/EmojiParser.java @@ -68,7 +68,7 @@ public final class EmojiParser { .build() .stream()) .collect(Collectors.toMap(Emoji::getUnicode, Function.identity())); - } catch (IOException e) { + } catch (Exception e) { Log.e(TAG, "EmojiParser: ", e); } }