aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/lang_detection.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-12-25 20:17:08 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-12-25 20:33:55 +0000
commit2d8c7bfb4e011bdcd4a632061e0f759abccff40a (patch)
tree5d89011737c33a32645e6d6ebea1c6dc7ae7a104 /src/libmime/lang_detection.c
parentae24d391fb899234fefa49fa6a557e7c77a96522 (diff)
downloadrspamd-2d8c7bfb4e011bdcd4a632061e0f759abccff40a.tar.gz
rspamd-2d8c7bfb4e011bdcd4a632061e0f759abccff40a.zip
[Minor] More divisions by zero
Diffstat (limited to 'src/libmime/lang_detection.c')
-rw-r--r--src/libmime/lang_detection.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index ba638982d..d0139919f 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -1308,6 +1308,10 @@ rspamd_language_detector_cmp_heuristic (gconstpointer a, gconstpointer b,
gdouble adj;
gdouble proba_adjusted, probb_adjusted, freqa, freqb;
+ if (cbd->d->total_occurencies == 0) {
+ return 0;
+ }
+
freqa = ((gdouble)canda->elt->occurencies) /
(gdouble)cbd->d->total_occurencies;
freqb = ((gdouble)candb->elt->occurencies) /