fixed npe caused by null emoji support
This commit is contained in:
parent
5e31c1f643
commit
e2c79d7438
|
@ -47,7 +47,7 @@ public class EmojiSupportUtils {
|
||||||
public static void applyEmoji(ExternalThemeManager manager, @NonNull Spannable text,
|
public static void applyEmoji(ExternalThemeManager manager, @NonNull Spannable text,
|
||||||
int textStart, int textLength) {
|
int textStart, int textLength) {
|
||||||
final ExternalThemeManager.Emoji emoji = manager.getEmoji();
|
final ExternalThemeManager.Emoji emoji = manager.getEmoji();
|
||||||
if (!emoji.isSupported()) return;
|
if (emoji == null || !emoji.isSupported()) return;
|
||||||
final CodePointArray array = new CodePointArray(text);
|
final CodePointArray array = new CodePointArray(text);
|
||||||
for (int arrayIdx = array.length() - 1; arrayIdx >= 0; arrayIdx--) {
|
for (int arrayIdx = array.length() - 1; arrayIdx >= 0; arrayIdx--) {
|
||||||
final int codePoint = array.get(arrayIdx);
|
final int codePoint = array.get(arrayIdx);
|
||||||
|
|
|
@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.res.ResourcesCompat;
|
import android.support.v4.content.res.ResourcesCompat;
|
||||||
import android.util.LruCache;
|
import android.util.LruCache;
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ public class ExternalThemeManager implements Constants {
|
||||||
emoji = new Emoji(application, emojiPackageName);
|
emoji = new Emoji(application, emojiPackageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@Nullable
|
||||||
public Emoji getEmoji() {
|
public Emoji getEmoji() {
|
||||||
return emoji;
|
return emoji;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue