From 1a18ea56ca8946059a80d42ff3d1076cd57e6204 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 9 May 2021 01:07:43 +0200 Subject: Fix NullPointerException when ready options from subtypes Seems like subtypes might not match what is declared. Must protect against that. --- srcs/juloo.keyboard2/Keyboard2.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'srcs/juloo.keyboard2/Keyboard2.java') 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) -- cgit v1.2.3