From 2d8c7bfb4e011bdcd4a632061e0f759abccff40a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 25 Dec 2021 20:17:08 +0000 Subject: [Minor] More divisions by zero --- src/libmime/lang_detection.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/libmime/lang_detection.c') 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) / -- cgit v1.2.3