diff options
author | 2013-08-22 22:01:19 +0900 | |
---|---|---|
committer | 2013-08-22 23:02:08 +0900 | |
commit | aa4168ee09e8bff6d4a27041566fe79f71cdbcf5 (patch) | |
tree | bf9447a0e4d7e2f54d77aa400fe37f43588091a7 /java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java | |
parent | e301085a70c9e5816fd98fb7d0fec3b2790b9359 (diff) | |
download | latinime-aa4168ee09e8bff6d4a27041566fe79f71cdbcf5.tar.gz latinime-aa4168ee09e8bff6d4a27041566fe79f71cdbcf5.tar.xz latinime-aa4168ee09e8bff6d4a27041566fe79f71cdbcf5.zip |
Fix writePlacedNode.
Change-Id: I1d6b086f1d9f0dbd8d74f964e29ae62c533af978
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java index 71c1d425c..40effb5e3 100644 --- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java +++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java @@ -108,7 +108,7 @@ public class BinaryDictEncoderUtils { * like address lists do. */ static int getShortcutListSize(final ArrayList<WeightedString> shortcutList) { - if (null == shortcutList) return 0; + if (null == shortcutList || shortcutList.isEmpty()) return 0; int size = FormatSpec.GROUP_SHORTCUT_LIST_SIZE_SIZE; for (final WeightedString shortcut : shortcutList) { size += getShortcutSize(shortcut); @@ -601,8 +601,9 @@ public class BinaryDictEncoderUtils { private static byte makeCharGroupFlags(final CharGroup group, final int groupAddress, final int childrenOffset, final FormatOptions formatOptions) { return (byte) makeCharGroupFlags(group.mChars.length > 1, group.mFrequency >= 0, - getByteSize(childrenOffset), group.mShortcutTargets != null, group.mBigrams != null, - group.mIsNotAWord, group.mIsBlacklistEntry, formatOptions); + getByteSize(childrenOffset), + group.mShortcutTargets != null && !group.mShortcutTargets.isEmpty(), + group.mBigrams != null, group.mIsNotAWord, group.mIsBlacklistEntry, formatOptions); } /** @@ -795,7 +796,7 @@ public class BinaryDictEncoderUtils { groupAddress += shift; // Write shortcuts - if (null != group.mShortcutTargets) { + if (null != group.mShortcutTargets && !group.mShortcutTargets.isEmpty()) { final int indexOfShortcutByteSize = index; index += FormatSpec.GROUP_SHORTCUT_LIST_SIZE_SIZE; groupAddress += FormatSpec.GROUP_SHORTCUT_LIST_SIZE_SIZE; |