From c2452e00c3243ac461428e62df60a35ef7adb966 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 5 Dec 2016 16:17:29 +0000 Subject: [PATCH] [Minor] Check if there are options in a symbol --- src/libserver/task.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/libserver/task.c b/src/libserver/task.c index 51d4da1e5..42f5e305e 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -1047,19 +1047,23 @@ rspamd_task_log_metric_res (struct rspamd_task *task, gpointer k, v; rspamd_printf_fstring (&symbuf, "{"); - j = 0; - g_hash_table_iter_init (&it, sym->options); - while (g_hash_table_iter_next (&it, &k, &v)) { - const char *opt = v; + if (sym->options) { + j = 0; + g_hash_table_iter_init (&it, sym->options); - rspamd_printf_fstring (&symbuf, "%s;", opt); + while (g_hash_table_iter_next (&it, &k, &v)) { + const char *opt = v; - if (j >= max_log_elts) { - rspamd_printf_fstring (&symbuf, "...;"); - break; + rspamd_printf_fstring (&symbuf, "%s;", opt); + + if (j >= max_log_elts) { + rspamd_printf_fstring (&symbuf, "...;"); + break; + } + + j ++; } - j ++; } rspamd_printf_fstring (&symbuf, "}"); -- 2.39.5