diff options
author | 2013-08-22 14:03:53 +0000 | |
---|---|---|
committer | 2013-08-22 14:03:53 +0000 | |
commit | 4929f8516c2b3582805e25e69d2b0b5a71bae53f (patch) | |
tree | a9860579bf868a955f9e42058468e368e895ac2f /java/src/com/android/inputmethod/latin/makedict/BinaryDictEncoderUtils.java | |
parent | 5f438d555c8553e4814abc6c0263c8c8f84a8220 (diff) | |
parent | aa4168ee09e8bff6d4a27041566fe79f71cdbcf5 (diff) | |
download | latinime-4929f8516c2b3582805e25e69d2b0b5a71bae53f.tar.gz latinime-4929f8516c2b3582805e25e69d2b0b5a71bae53f.tar.xz latinime-4929f8516c2b3582805e25e69d2b0b5a71bae53f.zip |
Merge "Fix writePlacedNode."
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; |