changeset 12570:a293626e09e2

doveadm quota: Don't crash if quota isn't enabled.
author Timo Sirainen <tss@iki.fi>
date Thu, 30 Dec 2010 12:45:52 +0200
parents 15c32384817b
children c67f4a2a2253
files src/plugins/quota/doveadm-quota.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/doveadm-quota.c	Thu Dec 30 12:40:50 2010 +0200
+++ b/src/plugins/quota/doveadm-quota.c	Thu Dec 30 12:45:52 2010 +0200
@@ -49,6 +49,9 @@
 	struct quota_user *quser = QUOTA_USER_CONTEXT(user);
 	struct quota_root *const *root;
 
+	if (quser == NULL)
+		i_fatal("Quota not enabled");
+
 	array_foreach(&quser->quota->roots, root)
 		cmd_quota_get_root(*root);
 }
@@ -86,6 +89,9 @@
 	struct quota_root *const *root;
 	struct quota_transaction_context trans;
 
+	if (quser == NULL)
+		i_fatal("Quota not enabled");
+
 	memset(&trans, 0, sizeof(trans));
 	trans.quota = quser->quota;
 	trans.recalculate = TRUE;