abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
authorJules Aguillon2021-05-09 01:07:43 +0200
committerJules Aguillon2021-05-09 01:07:43 +0200
commit1a18ea56ca8946059a80d42ff3d1076cd57e6204 (patch)
tree39d5548fd692076470a3ac792ab4b7ec0bb521d2 /srcs
parent68945ff2271fafc14aec9740c45c22e23bd433de (diff)
downloadunexpected-keyboard-1a18ea56ca8946059a80d42ff3d1076cd57e6204.tar.gz
unexpected-keyboard-1a18ea56ca8946059a80d42ff3d1076cd57e6204.zip
Fix NullPointerException when ready options from subtypes
Seems like subtypes might not match what is declared. Must protect against that.
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index e32de42..fa4956c 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -80,10 +80,14 @@ public class Keyboard2 extends InputMethodService
private void refreshSubtypeLayout(InputMethodSubtype subtype)
{
- if (_config.layout == -1)
- _currentTextLayout = Config.layoutId_of_string(subtype.getExtraValueOf("default_layout"));
- else
- _currentTextLayout = _config.layout;
+ int l = _config.layout;;
+ if (l == -1)
+ {
+ String s = subtype.getExtraValueOf("default_layout");
+ if (s != null)
+ l = Config.layoutId_of_string(s);
+ }
+ _currentTextLayout = l;
}
private int accents_of_subtype(InputMethodSubtype subtype)