diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-12 16:27:25 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-12 16:27:25 +0000 |
commit | ad06636cc54ee400e2ca90b685296c153a3add7a (patch) | |
tree | 5d046383b73657011099daaaa719f5e9f3766676 /src/libstat/learn_cache/sqlite3_cache.c | |
parent | 20c9bfdc2db1066ac174b462c5e9e48287b63ee7 (diff) | |
download | rspamd-ad06636cc54ee400e2ca90b685296c153a3add7a.tar.gz rspamd-ad06636cc54ee400e2ca90b685296c153a3add7a.zip |
Don't fail stats when pre-results are set
Diffstat (limited to 'src/libstat/learn_cache/sqlite3_cache.c')
-rw-r--r-- | src/libstat/learn_cache/sqlite3_cache.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libstat/learn_cache/sqlite3_cache.c b/src/libstat/learn_cache/sqlite3_cache.c index 288cad0ee..41731fa10 100644 --- a/src/libstat/learn_cache/sqlite3_cache.c +++ b/src/libstat/learn_cache/sqlite3_cache.c @@ -183,6 +183,10 @@ rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, gint rc; gint64 flag; + if (task->tokens == NULL || task->tokens->len == 0) { + return RSPAMD_LEARN_INGORE; + } + if (ctx != NULL && ctx->db != NULL) { out = rspamd_mempool_alloc (task->task_pool, rspamd_cryptobox_HASHBYTES); @@ -223,9 +227,6 @@ rspamd_stat_cache_sqlite3_check (struct rspamd_task *task, return RSPAMD_LEARN_UNLEARN; } } - else { - - } } return RSPAMD_LEARN_OK; @@ -242,7 +243,10 @@ rspamd_stat_cache_sqlite3_learn (struct rspamd_task *task, gint64 flag; h = rspamd_mempool_get_variable (task->task_pool, "words_hash"); - g_assert (h != NULL); + + if (h == NULL) { + return RSPAMD_LEARN_INGORE; + } flag = !!is_spam ? 1 : 0; |