]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Check if there are options in a symbol
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 5 Dec 2016 16:17:29 +0000 (16:17 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 5 Dec 2016 16:17:29 +0000 (16:17 +0000)
src/libserver/task.c

index 51d4da1e59ce3f5f0509db7997942b5fbe77ccd9..42f5e305e85b58a4dd4ecb983bf486793a602fd8 100644 (file)
@@ -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, "}");