aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorYuichiro Hanada <yhanada@google.com>2013-10-16 17:16:26 +0900
committerYuichiro Hanada <yhanada@google.com>2013-10-16 17:16:26 +0900
commit7b5f2b71f5ce8af82b4c0faad38437bca750cffe (patch)
treec0a556466e40b32962c62279a118a373fc500f51 /java/src
parent008d84ffa5ee996a8a7ffa44ee29e54169247ffb (diff)
downloadlatinime-7b5f2b71f5ce8af82b4c0faad38437bca750cffe.tar.gz
latinime-7b5f2b71f5ce8af82b4c0faad38437bca750cffe.tar.xz
latinime-7b5f2b71f5ce8af82b4c0faad38437bca750cffe.zip
Fix Ver4DictDecoder.readAndFollowForwardLink().
Change-Id: Ib527a376b693be21aebd4920ac804ee9b161eb96
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
index cc6a54569..a94e04a8e 100644
--- a/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
+++ b/java/src/com/android/inputmethod/latin/makedict/Ver4DictDecoder.java
@@ -319,10 +319,13 @@ public class Ver4DictDecoder extends AbstractDictDecoder {
@Override
public boolean readAndFollowForwardLink() {
final int forwardLinkPos = mDictBuffer.position();
- final int nextAddress = forwardLinkPos + BinaryDictDecoderUtils.readSInt24(mDictBuffer);
- if (nextAddress >= 0 && nextAddress < mDictBuffer.limit()) {
- mDictBuffer.position(nextAddress);
- return true;
+ int nextRelativePos = BinaryDictDecoderUtils.readSInt24(mDictBuffer);
+ if (nextRelativePos != FormatSpec.NO_FORWARD_LINK_ADDRESS) {
+ final int nextPos = forwardLinkPos + nextRelativePos;
+ if (nextPos >= 0 && nextPos < mDictBuffer.limit()) {
+ mDictBuffer.position(nextPos);
+ return true;
+ }
}
return false;
}