Fix NullPointerException when ready options from subtypes

Seems like subtypes might not match what is declared. Must protect
against that.
This commit is contained in:
Jules Aguillon 2021-05-09 01:07:43 +02:00
parent 68945ff227
commit 1a18ea56ca

View File

@ -80,10 +80,14 @@ public class Keyboard2 extends InputMethodService
private void refreshSubtypeLayout(InputMethodSubtype subtype) private void refreshSubtypeLayout(InputMethodSubtype subtype)
{ {
if (_config.layout == -1) int l = _config.layout;;
_currentTextLayout = Config.layoutId_of_string(subtype.getExtraValueOf("default_layout")); if (l == -1)
else {
_currentTextLayout = _config.layout; String s = subtype.getExtraValueOf("default_layout");
if (s != null)
l = Config.layoutId_of_string(s);
}
_currentTextLayout = l;
} }
private int accents_of_subtype(InputMethodSubtype subtype) private int accents_of_subtype(InputMethodSubtype subtype)