changeset 20257:7e6d01439d76

doveadm: error to print formatted without format This changes the segfault of `doveadm -f formatted ...` to an error.
author Martti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
date Wed, 20 Apr 2016 14:33:57 +0300
parents 53d27b48c606
children a326b886ecbd
files src/doveadm/doveadm-print-formatted.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/doveadm-print-formatted.c	Sat Apr 30 14:22:21 2016 +0200
+++ b/src/doveadm/doveadm-print-formatted.c	Wed Apr 20 14:33:57 2016 +0300
@@ -53,6 +53,9 @@
 
 static void doveadm_print_formatted_print(const char *value)
 {
+	if (ctx.format == NULL) {
+		i_fatal("formatted formatter cannot be used without a format.");
+	}
 	struct var_expand_table *entry = array_idx_modifiable(&ctx.headers, ctx.idx++);
 	entry->value = value;