aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/classifiers
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-22 17:02:10 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-07-22 17:02:10 +0100
commitbc235cf8d945e58b9fe13d5d17973457f45b8480 (patch)
tree8ef44a1e1552881129d6708adf92a52e093c6340 /src/libstat/classifiers
parentdd3b11704d96d23c5c41641c53657367282b45f1 (diff)
downloadrspamd-bc235cf8d945e58b9fe13d5d17973457f45b8480.tar.gz
rspamd-bc235cf8d945e58b9fe13d5d17973457f45b8480.zip
Another iteration on #331.
Diffstat (limited to 'src/libstat/classifiers')
-rw-r--r--src/libstat/classifiers/bayes.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index 03512f771..e248fd6e6 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -256,12 +256,14 @@ bayes_learn_spam_callback (gpointer key, gpointer value, gpointer data)
for (i = rt->start_pos; i < rt->end_pos; i++) {
res = &g_array_index (node->results, struct rspamd_token_result, i);
- if (res->st_runtime->st->is_spam) {
- res->value ++;
- }
- else if (res->value > 0) {
- /* Unlearning */
- res->value --;
+ if (res->st_runtime) {
+ if (res->st_runtime->st->is_spam) {
+ res->value ++;
+ }
+ else if (res->value > 0) {
+ /* Unlearning */
+ res->value --;
+ }
}
}
@@ -280,11 +282,13 @@ bayes_learn_ham_callback (gpointer key, gpointer value, gpointer data)
for (i = rt->start_pos; i < rt->end_pos; i++) {
res = &g_array_index (node->results, struct rspamd_token_result, i);
- if (!res->st_runtime->st->is_spam) {
- res->value ++;
- }
- else if (res->value > 0) {
- res->value --;
+ if (res->st_runtime) {
+ if (!res->st_runtime->st->is_spam) {
+ res->value ++;
+ }
+ else if (res->value > 0) {
+ res->value --;
+ }
}
}