diff options
author | 2012-01-13 20:50:43 +0900 | |
---|---|---|
committer | 2012-01-13 20:50:43 +0900 | |
commit | 512c669fee6aa90dbfb3e00a1be7730eb807c9a0 (patch) | |
tree | 0ac671148b87c021689fbf21f950645567c246ec | |
parent | ca132ce8e224eaae6d7d9b01fb6183708779684b (diff) | |
download | latinime-512c669fee6aa90dbfb3e00a1be7730eb807c9a0.tar.gz latinime-512c669fee6aa90dbfb3e00a1be7730eb807c9a0.tar.xz latinime-512c669fee6aa90dbfb3e00a1be7730eb807c9a0.zip |
Fix a native crash with shortcuts
Creation of the TerminalAttributes object failed to take into
account that there may be children on this node.
Change-Id: I8224a1a51532d1a40a8555f46425e3744388326b
-rw-r--r-- | native/src/unigram_dictionary.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp index a6ecc2d28..bbae5a864 100644 --- a/native/src/unigram_dictionary.cpp +++ b/native/src/unigram_dictionary.cpp @@ -662,8 +662,9 @@ inline bool UnigramDictionary::processCurrentNode(const int initialPos, // The frequency should be here, because we come here only if this is actually // a terminal node, and we are on its last char. const int freq = BinaryFormat::readFrequencyWithoutMovingPointer(DICT_ROOT, pos); - TerminalAttributes terminalAttributes(DICT_ROOT, flags, - BinaryFormat::skipFrequency(flags, pos)); + const int childrenAddressPos = BinaryFormat::skipFrequency(flags, pos); + const int attributesPos = BinaryFormat::skipChildrenPosition(flags, childrenAddressPos); + TerminalAttributes terminalAttributes(DICT_ROOT, flags, attributesPos); onTerminal(freq, terminalAttributes, correction, queue); } |