summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/PYLibPinyin.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/PYLibPinyin.cc b/src/PYLibPinyin.cc
index 3ea3cff..0090c0c 100644
--- a/src/PYLibPinyin.cc
+++ b/src/PYLibPinyin.cc
@@ -274,6 +274,10 @@ LibPinyinBackEnd::rememberUserInput (pinyin_instance_t * instance)
/* pre-check the incomplete pinyin keys. */
guint len = 0;
g_assert (pinyin_get_n_pinyin (instance, &len));
+
+ if (0 == len || len >= MAX_PHRASE_LENGTH)
+ return FALSE;
+
size_t i = 0;
for ( ; i < len; ++i) {
PinyinKey *key = NULL;