mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Avoid crash if no supported languages can be added
This commit is contained in:
parent
97859147d9
commit
b985c3a283
@ -63,11 +63,18 @@ object Subtypes {
|
||||
val locales = context.resources.configuration.locales
|
||||
if(locales.size() == 0) return
|
||||
|
||||
var numAdded = 0
|
||||
for(i in 0 until locales.size()) {
|
||||
val locale = locales.get(i)
|
||||
val layout = findClosestLocaleLayouts(locale).firstOrNull() ?: continue
|
||||
|
||||
addLanguage(context, locale, layout)
|
||||
numAdded += 1
|
||||
}
|
||||
|
||||
if(numAdded == 0) {
|
||||
// We need to have something...
|
||||
addLanguage(context, Locale.forLanguageTag("zz"), "qwerty")
|
||||
}
|
||||
|
||||
context.setSettingBlocking(ActiveSubtype.key, context.getSettingBlocking(SubtypesSetting).first())
|
||||
|
Loading…
Reference in New Issue
Block a user