diff options
-rw-r--r-- | src/libstat/stat_process.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 086b7e298..83621c973 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -347,6 +347,10 @@ rspamd_stat_classify (struct rspamd_task *task, lua_State *L, guint stage, st_ctx = rspamd_stat_get_ctx (); g_assert (st_ctx != NULL); + if (st_ctx->classifiers->len == 0) { + task->processed_stages |= stage; + return ret; + } if (stage == RSPAMD_TASK_STAGE_CLASSIFIERS_PRE) { /* Preprocess tokens */ @@ -603,6 +607,7 @@ rspamd_stat_learn (struct rspamd_task *task, GError **err) { struct rspamd_stat_ctx *st_ctx; + rspamd_stat_result_t ret = RSPAMD_STAT_PROCESS_OK; /* * We assume now that a task has been already classified before @@ -610,11 +615,14 @@ rspamd_stat_learn (struct rspamd_task *task, */ g_assert (RSPAMD_TASK_IS_CLASSIFIED (task)); - rspamd_stat_result_t ret = RSPAMD_STAT_PROCESS_OK; - st_ctx = rspamd_stat_get_ctx (); g_assert (st_ctx != NULL); + if (st_ctx->classifiers->len == 0) { + task->processed_stages |= stage; + return ret; + } + if (stage == RSPAMD_TASK_STAGE_LEARN_PRE) { /* Process classifiers */ if (!rspamd_stat_cache_check (st_ctx, task, classifier, spam, err)) { |