aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/classifiers
diff options
context:
space:
mode:
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 --;
+ }
}
}