diff options
author | 2014-12-15 18:53:22 +0900 | |
---|---|---|
committer | 2014-12-15 18:53:22 +0900 | |
commit | 5e1b2250821fa1f23720b260d94d104c63722096 (patch) | |
tree | 5b92807c3343538cec91b10626e09247ec559e5b /native | |
parent | ad546afbaa1eea4b291ed021f86fab7652b5d205 (diff) | |
download | latinime-5e1b2250821fa1f23720b260d94d104c63722096.tar.gz latinime-5e1b2250821fa1f23720b260d94d104c63722096.tar.xz latinime-5e1b2250821fa1f23720b260d94d104c63722096.zip |
Add missing error check in TrieMap.
Bug: 18725954
Change-Id: I8fcb0d15dda3f823a4575fe707bcdec57ff5e89b
Diffstat (limited to 'native')
-rw-r--r-- | native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp index 39f417ebb..b7ef2b9bd 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/trie_map.cpp @@ -79,6 +79,9 @@ int TrieMap::getNextLevelBitmapEntryIndex(const int key, const int bitmapEntryIn } // Create a value entry and a bitmap entry. const int valueEntryIndex = allocateTable(TERMINAL_LINKED_ENTRY_COUNT); + if (valueEntryIndex == INVALID_INDEX) { + return INVALID_INDEX; + } if (!writeEntry(Entry(0, terminalEntry.getValue()), valueEntryIndex)) { return INVALID_INDEX; } @@ -195,6 +198,9 @@ bool TrieMap::writeValue(const uint64_t value, const int terminalEntryIndex) { } // Create value entry and write value. const int valueEntryIndex = allocateTable(TERMINAL_LINKED_ENTRY_COUNT); + if (valueEntryIndex == INVALID_INDEX) { + return false; + } if (!writeEntry(Entry(value >> (FIELD1_SIZE * CHAR_BIT), value), valueEntryIndex)) { return false; } |