From 10c8ad2246130d77b19ee7036e3f0a74c47425a1 Mon Sep 17 00:00:00 2001 From: "cebka@lenovo-laptop" Date: Fri, 5 Feb 2010 18:51:16 +0300 Subject: [PATCH] * Handle empty messages in learning --- src/controller.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/controller.c b/src/controller.c index 4e4b44cb3..d76c35db3 100644 --- a/src/controller.c +++ b/src/controller.c @@ -686,6 +686,17 @@ controller_read_socket (f_str_t * in, void *arg) cur = g_list_next (cur); } + /* Handle messages without text */ + if (tokens == NULL) { + i = snprintf (out_buf, sizeof (out_buf), "learn fail, no tokens can be extracted (no text data)" CRLF); + free_task (task, FALSE); + if (!rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE)) { + return FALSE; + } + session->state = STATE_REPLY; + return TRUE; + } + /* Get or create statfile */ statfile = get_statfile_by_symbol (session->worker->srv->statfile_pool, session->learn_classifier, session->learn_symbol, &st, TRUE); -- 2.39.5