fixing a crash at toggling caps lock, if keys have no label

This commit is contained in:
tibbi 2022-01-08 17:56:29 +01:00
parent ee4b545b74
commit 5ab9c94958

View file

@ -460,7 +460,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
private fun adjustCase(label: CharSequence): CharSequence? {
var newLabel: CharSequence? = label
if (mKeyboard!!.isShifted && newLabel != null && newLabel.length < 3 && Character.isLowerCase(newLabel[0])) {
if (newLabel != null && newLabel.isNotEmpty() && mKeyboard!!.isShifted && newLabel.length < 3 && Character.isLowerCase(newLabel[0])) {
newLabel = newLabel.toString().toUpperCase()
}
return newLabel