From: Vsevolod Stakhov Date: Mon, 5 Dec 2016 16:17:29 +0000 (+0000) Subject: [Minor] Check if there are options in a symbol X-Git-Tag: 1.5.0~663 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2452e00c3243ac461428e62df60a35ef7adb966;p=thirdparty%2Frspamd.git [Minor] Check if there are options in a symbol --- diff --git a/src/libserver/task.c b/src/libserver/task.c index 51d4da1e59..42f5e305e8 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, "}");