From a5a34693fca0d9582fb806dc12f2ab93ec31d65a Mon Sep 17 00:00:00 2001 From: sspanak Date: Tue, 10 Jun 2025 13:34:26 +0300 Subject: [PATCH] fixed a rare NullPointerException when changing the text case right when the suggestion list becomes empty --- .../main/java/io/github/sspanak/tt9/ime/CommandHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/github/sspanak/tt9/ime/CommandHandler.java b/app/src/main/java/io/github/sspanak/tt9/ime/CommandHandler.java index 987f008c..c7ed1bd9 100644 --- a/app/src/main/java/io/github/sspanak/tt9/ime/CommandHandler.java +++ b/app/src/main/java/io/github/sspanak/tt9/ime/CommandHandler.java @@ -218,8 +218,8 @@ abstract public class CommandHandler extends TextEditingHandler { } // if there are no suggestions or they are special chars, we don't need to adjust their text case - final String before = suggestionOps.getCurrent(); - boolean beforeStartsWithLetter = !before.isEmpty() && Character.isAlphabetic(before.charAt(0)); + final String before = suggestionOps.isEmpty() || mInputMode.getSequence().isEmpty() ? "" : suggestionOps.getCurrent(); + final boolean beforeStartsWithLetter = !before.isEmpty() && Character.isAlphabetic(before.charAt(0)); if (!beforeStartsWithLetter) { settings.saveTextCase(mInputMode.getTextCase()); return true;