diff options
author | 2012-05-23 14:48:16 +0900 | |
---|---|---|
committer | 2012-05-23 14:48:16 +0900 | |
commit | d6e238fc33e9f3fd280460de1069d24526a23271 (patch) | |
tree | 562593202107e8e85bbd36706544e9b01f80af11 /java/src | |
parent | 37f81cd6e9a10fbdb3a1a054c88a6b5d98fb0f88 (diff) | |
download | latinime-d6e238fc33e9f3fd280460de1069d24526a23271.tar.gz latinime-d6e238fc33e9f3fd280460de1069d24526a23271.tar.xz latinime-d6e238fc33e9f3fd280460de1069d24526a23271.zip |
Fix RuntiomeException when no custom input style is defined
Bug: 6524480
Change-Id: I6bceea9fe07095b9ff3ed25c5677a82fa5d4086a
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/AdditionalSubtype.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/AdditionalSubtype.java b/java/src/com/android/inputmethod/latin/AdditionalSubtype.java index f0076a5b6..ffdbfbb67 100644 --- a/java/src/com/android/inputmethod/latin/AdditionalSubtype.java +++ b/java/src/com/android/inputmethod/latin/AdditionalSubtype.java @@ -22,6 +22,7 @@ import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOAR import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.UNTRANSLATABLE_STRING_IN_SUBTYPE_NAME; import android.os.Build; +import android.text.TextUtils; import android.view.inputmethod.InputMethodSubtype; import java.util.ArrayList; @@ -84,11 +85,14 @@ public class AdditionalSubtype { } public static InputMethodSubtype[] createAdditionalSubtypesArray(String prefSubtypes) { + if (TextUtils.isEmpty(prefSubtypes)) { + return null; + } final String[] prefSubtypeArray = prefSubtypes.split(PREF_SUBTYPE_SEPARATOR); final ArrayList<InputMethodSubtype> subtypesList = new ArrayList<InputMethodSubtype>(prefSubtypeArray.length); - for (int i = 0; i < prefSubtypeArray.length; i++) { - final InputMethodSubtype subtype = createAdditionalSubtype(prefSubtypeArray[i]); + for (final String prefSubtype : prefSubtypeArray) { + final InputMethodSubtype subtype = createAdditionalSubtype(prefSubtype); if (subtype.getNameResId() == SubtypeLocale.UNKNOWN_KEYBOARD_LAYOUT) { // Skip unknown keyboard layout subtype. This may happen when predefined keyboard // layout has been removed. |