From bdfa736e1fcb76b6b6d34071a7f57f37d2da67c1 Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Wed, 24 Jul 2024 23:57:02 +0300 Subject: [PATCH] Mitigate crash in getSubtypeDisplayNameInSystemLocale --- .../org/futo/inputmethod/latin/utils/SubtypeLocaleUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/java/src/org/futo/inputmethod/latin/utils/SubtypeLocaleUtils.java b/java/src/org/futo/inputmethod/latin/utils/SubtypeLocaleUtils.java index da0248c1b..c35921929 100644 --- a/java/src/org/futo/inputmethod/latin/utils/SubtypeLocaleUtils.java +++ b/java/src/org/futo/inputmethod/latin/utils/SubtypeLocaleUtils.java @@ -28,6 +28,7 @@ import android.view.inputmethod.InputMethodSubtype; import org.futo.inputmethod.latin.R; import org.futo.inputmethod.latin.Subtypes; +import org.futo.inputmethod.latin.SubtypesKt; import org.futo.inputmethod.latin.common.LocaleUtils; import org.futo.inputmethod.latin.common.StringUtils; @@ -269,6 +270,9 @@ public final class SubtypeLocaleUtils { @Nonnull public static String getSubtypeDisplayNameInSystemLocale( @Nonnull final InputMethodSubtype subtype) { + if(sResources == null) { + return Subtypes.INSTANCE.getLocale(subtype).getDisplayName(); + } final Locale displayLocale = sResources.getConfiguration().locale; return getSubtypeDisplayNameInternal(subtype, displayLocale); }