]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix another fuzzy stat issue
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Jul 2019 14:47:21 +0000 (15:47 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 22 Jul 2019 14:47:21 +0000 (15:47 +0100)
Issue: #2989

src/plugins/fuzzy_check.c

index a72dfbbb0073e3c9d7b347902ff884e5b854dce4..385c16b7108cf5b6bc4aa302b29497d4ffa107f1 100644 (file)
@@ -2139,18 +2139,21 @@ fuzzy_insert_metric_results (struct rspamd_task *task, GPtrArray *results)
                }
        }
 
-       PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, text_parts), i, tp) {
-               if (!IS_PART_EMPTY (tp)) {
-                       seen_text = TRUE;
-               }
-               else if (tp->utf_stripped_text.magic == UTEXT_MAGIC) {
-                       if (utext_isLengthExpensive (&tp->utf_stripped_text)) {
-                               seen_long_text =
-                                               utext_nativeLength (&tp->utf_stripped_text) > text_length_cutoff;
+       if (task->message) {
+               PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, text_parts), i, tp) {
+                       if (!IS_PART_EMPTY (tp)) {
+                               seen_text = TRUE;
                        }
-                       else {
-                               /* Cannot directly calculate length */
-                               seen_long_text = tp->utf_stripped_content->len / 2 > text_length_cutoff;
+                       else if (tp->utf_stripped_text.magic == UTEXT_MAGIC) {
+                               if (utext_isLengthExpensive (&tp->utf_stripped_text)) {
+                                       seen_long_text =
+                                                       utext_nativeLength (&tp->utf_stripped_text) > text_length_cutoff;
+                               }
+                               else {
+                                       /* Cannot directly calculate length */
+                                       seen_long_text =
+                                                       tp->utf_stripped_content->len / 2 > text_length_cutoff;
+                               }
                        }
                }
        }