Fix an unexplained crash encountered in the wild

For some reason, 'subtype' can be null. Perhaps because the keyboard is
started before the IMM is ready.
This commit is contained in:
Jules Aguillon 2022-09-24 23:34:50 +02:00
parent 90b9b0e399
commit 64e263a1af

View File

@ -147,8 +147,16 @@ public class Keyboard2 extends InputMethodService
else
{
InputMethodSubtype subtype = imm.getCurrentInputMethodSubtype();
refreshSubtypeLayout(subtype);
refreshAccentsOption(imm, subtype);
if (subtype == null)
{
// On some rare cases, [subtype] is null.
refreshSubtypeLegacyFallback();
}
else
{
refreshSubtypeLayout(subtype);
refreshAccentsOption(imm, subtype);
}
}
_config.shouldOfferSwitchingToProgramming =
_config.programming_layout != -1 &&