From b7cdafd78a7e97c70ceaa3349197eb012e69cc3f Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 27 Jun 2012 20:35:25 +0900 Subject: Don't pass everything to a function that needs only the head (A2) Change-Id: Ic367836202ab8071c1a9a02eaf0651b0da947d51 --- java/src/com/android/inputmethod/latin/Suggest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/latin/Suggest.java') diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 08a7b869d..baf24c8ae 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -249,6 +249,8 @@ public class Suggest { transformedWordInfo.mSourceDict); } + final SuggestedWordInfo bestSuggestion = suggestionsContainer.isEmpty() + ? null : suggestionsContainer.get(0); final CharSequence whitelistedWord = capitalizeWord(isAllUpperCase, isFirstCharCapitalized, mWhiteListDictionary.getWhitelistedWord(consideredWord)); @@ -256,7 +258,7 @@ public class Suggest { if (isCorrectionEnabled) { final CharSequence autoCorrection = AutoCorrection.computeAutoCorrectionWord(mDictionaries, wordComposer, - suggestionsContainer, consideredWord, mAutoCorrectionThreshold, + bestSuggestion, consideredWord, mAutoCorrectionThreshold, whitelistedWord); hasAutoCorrection = (null != autoCorrection); } else { -- cgit v1.2.3-83-g751a