am 676917de: Merge "Fail faster in case of a bug"

* commit '676917dea2595d7bbc1f24a44034a4254a1884fa':
  Fail faster in case of a bug
main
Jean Chalard 2011-12-15 10:08:26 -08:00 committed by Android Git Automerger
commit b60ab9752c
1 changed files with 4 additions and 4 deletions

View File

@ -1606,10 +1606,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (pickedDefaultSuggestion) { if (pickedDefaultSuggestion) {
final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull(); final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull();
final String typedWord = mWordComposer.getTypedWord(); 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)) { if (!typedWord.equals(autoCorrection)) {
// This will make the correction flash for a short while as a visual clue // This will make the correction flash for a short while as a visual clue
// to the user that auto-correction happened. // to the user that auto-correction happened.
@ -1882,6 +1878,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull(); final CharSequence autoCorrection = mWordComposer.getAutoCorrectionOrNull();
if (autoCorrection != null) { if (autoCorrection != null) {
final String typedWord = mWordComposer.getTypedWord(); 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); Utils.Stats.onAutoCorrection(typedWord, autoCorrection.toString(), separatorCode);
mExpectingUpdateSelection = true; mExpectingUpdateSelection = true;
commitBestWord(autoCorrection); commitBestWord(autoCorrection);