fixes test chewing table
authorPeng Wu <alexepico@gmail.com>
Tue, 6 Dec 2011 10:10:20 +0000 (18:10 +0800)
committerPeng Wu <alexepico@gmail.com>
Tue, 6 Dec 2011 10:10:20 +0000 (18:10 +0800)
tests/storage/test_chewing_table.cpp

index dfc1fca977763fbe3322b90f761e1ee11da015da..157a3676c0f89256fcc643b54f9b3fa09e7d8bad 100644 (file)
@@ -67,7 +67,12 @@ int main(int argc, char * argv[]) {
         ChewingKeyVector keys = g_array_new(FALSE, FALSE, sizeof(ChewingKey));
         ChewingKeyRestVector key_rests =
             g_array_new(FALSE, FALSE, sizeof(ChewingKeyRest));
+
         parser.parse(options, keys, key_rests, linebuf, strlen(linebuf));
+        if (0 == keys->len) {
+            fprintf(stderr, "Invalid input.\n");
+            continue;
+        }
 
         guint32 start = record_time();
         PhraseIndexRanges ranges;