Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3255b9da authored by Ken Wakasa's avatar Ken Wakasa Committed by Android Git Automerger
Browse files

am 256937b4: Merge "Fix getChildrenPosition."

* commit '256937b4':
  Fix getChildrenPosition.
parents 6e0bdd58 256937b4
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -758,9 +758,16 @@ public class BinaryDictEncoderUtils {
            final FormatOptions formatOptions) {
        int positionOfChildrenPosField = ptNode.mCachedAddressAfterUpdate
                + getNodeHeaderSize(ptNode, formatOptions);
        if (ptNode.mFrequency >= 0) {
        if (ptNode.isTerminal()) {
            // A terminal node has either the terminal id or the frequency.
            // If positionOfChildrenPosField is incorrect, we may crash when jumping to the children
            // position.
            if (formatOptions.mHasTerminalId) {
                positionOfChildrenPosField += FormatSpec.PTNODE_TERMINAL_ID_SIZE;
            } else {
                positionOfChildrenPosField += FormatSpec.PTNODE_FREQUENCY_SIZE;
            }
        }
        return null == ptNode.mChildren ? FormatSpec.NO_CHILDREN_ADDRESS
                : ptNode.mChildren.mCachedAddressAfterUpdate - positionOfChildrenPosField;
    }