diff options
| author | Jules Aguillon | 2022-09-24 23:34:50 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2022-09-24 23:34:50 +0200 |
| commit | 64e263a1af9b6310fc0913be1e141cc4c86894a5 (patch) | |
| tree | 11d487ded17db1f96f96fa3de92a94ca007f35e9 | |
| parent | 90b9b0e399b405e3346960d5a356f01e2b3c66b6 (diff) | |
| download | unexpected-keyboard-64e263a1af9b6310fc0913be1e141cc4c86894a5.tar.gz unexpected-keyboard-64e263a1af9b6310fc0913be1e141cc4c86894a5.zip | |
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.
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index ccc4be5..bb51999 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -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 && |
