aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libmime/lang_detection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index 9c29212dd..7bfcf0164 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -1471,7 +1471,10 @@ rspamd_language_detector_set_language (struct rspamd_task *task,
r->prob = 1.0;
r->lang = code;
- part->languages = g_ptr_array_sized_new (1);
+ if (part->languages == NULL) {
+ part->languages = g_ptr_array_sized_new (1);
+ }
+
g_ptr_array_add (part->languages, r);
part->language = code;
}