summaryrefslogtreecommitdiffstats
path: root/src/storage/chewing_large_table.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage/chewing_large_table.cpp')
-rw-r--r--src/storage/chewing_large_table.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/storage/chewing_large_table.cpp b/src/storage/chewing_large_table.cpp
index 9185976..ff53b75 100644
--- a/src/storage/chewing_large_table.cpp
+++ b/src/storage/chewing_large_table.cpp
@@ -490,7 +490,8 @@ int ChewingBitmapIndexLevel::remove_index(int phrase_length,
int ChewingLengthIndexLevel::add_index(int phrase_length,
/* in */ ChewingKey keys[],
/* in */ phrase_token_t token) {
- assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
+ if (!(phrase_length + 1 < MAX_PHRASE_LENGTH))
+ return ERROR_PHRASE_TOO_LONG;
if (m_chewing_array_indexes->len <= phrase_length)
g_array_set_size(m_chewing_array_indexes, phrase_length + 1);
@@ -532,7 +533,8 @@ int ChewingLengthIndexLevel::add_index(int phrase_length,
int ChewingLengthIndexLevel::remove_index(int phrase_length,
/* in */ ChewingKey keys[],
/* in */ phrase_token_t token) {
- assert(phrase_length + 1 < MAX_PHRASE_LENGTH);
+ if (!(phrase_length + 1 < MAX_PHRASE_LENGTH))
+ return ERROR_PHRASE_TOO_LONG;
if (m_chewing_array_indexes->len <= phrase_length)
return ERROR_REMOVE_ITEM_DONOT_EXISTS;