mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-16 23:12:47 +00:00
warn instead of crashing
This commit is contained in:
parent
90b4c60dd0
commit
454727eaeb
1 changed files with 5 additions and 3 deletions
|
@ -5,6 +5,7 @@ import android.content.SharedPreferences
|
|||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import android.view.inputmethod.InputMethodSubtype
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.LocaleManagerCompat
|
||||
import androidx.core.content.edit
|
||||
import org.dslul.openboard.inputmethod.keyboard.KeyboardSwitcher
|
||||
|
@ -239,10 +240,11 @@ private fun loadEnabledSubtypes(context: Context) {
|
|||
|
||||
val subtype = subtypesForLocale.firstOrNull { SubtypeLocaleUtils.getKeyboardLayoutSetName(it) == localeAndLayout.last() }
|
||||
?: additionalSubtypes.firstOrNull { it.locale() == localeAndLayout.first() && SubtypeLocaleUtils.getKeyboardLayoutSetName(it) == localeAndLayout.last() }
|
||||
if (BuildConfig.DEBUG) // should not happen, but should not crash for normal user
|
||||
require(subtype != null)
|
||||
else if (subtype == null)
|
||||
if (subtype == null) {
|
||||
if (BuildConfig.DEBUG)
|
||||
Toast.makeText(context, "subtype $localeAndLayout could not be loaded", Toast.LENGTH_LONG).show()
|
||||
continue
|
||||
}
|
||||
|
||||
enabledSubtypes.add(subtype)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue