From 46798d8f1f3d9012433d000790ba30ba910c0fa0 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 14 Dec 2011 17:54:18 +0900 Subject: [PATCH] Fail faster in case of a bug Change-Id: Ibea64133f200dce80034c641d4798b62843a2512 --- java/src/com/android/inputmethod/latin/LatinIME.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index ff850b7d0..9633e665a 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1606,10 +1606,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (pickedDefaultSuggestion) { final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull(); final String typedWord = mWordComposer.getTypedWord(); - if (TextUtils.isEmpty(typedWord)) { - throw new RuntimeException("We have non-committed chars but the typed word " - + "is empty? Impossible! I must commit suicide."); - } if (!typedWord.equals(autoCorrection)) { // This will make the correction flash for a short while as a visual clue // to the user that auto-correction happened. @@ -1882,6 +1878,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull(); if (autoCorrection != null) { final String typedWord = mWordComposer.getTypedWord(); + if (TextUtils.isEmpty(typedWord)) { + throw new RuntimeException("We have an auto-correction but the typed word " + + "is empty? Impossible! I must commit suicide."); + } Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorCode); mExpectingUpdateSelection = true; commitBestWord(autoCorrection);