changeset 4392:ed8e49b0a4ae HEAD

Don't crash if dict_lookup() didn't return success.
author Timo Sirainen <tss@iki.fi>
date Sat, 17 Jun 2006 15:21:21 +0300
parents ec5a8b1523a3
children 9928ebb54719
files src/plugins/quota/quota-dict.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota-dict.c	Sat Jun 17 15:20:21 2006 +0300
+++ b/src/plugins/quota/quota-dict.c	Sat Jun 17 15:21:21 2006 +0300
@@ -114,7 +114,7 @@
 		t_push();
 		ret = dict_lookup(root->dict, unsafe_data_stack_pool,
 				  DICT_QUOTA_CURRENT_BYTES_PATH, &value);
-		*value_r = value == NULL ? 0 : strtoull(value, NULL, 10) / 1024;
+		*value_r = ret <= 0 ? 0 : strtoull(value, NULL, 10) / 1024;
 		t_pop();
 	} else if (strcmp(name, QUOTA_NAME_MESSAGES) == 0) {
 		if (root->message_count_limit == (uint64_t)-1)
@@ -124,7 +124,7 @@
 		t_push();
 		ret = dict_lookup(root->dict, unsafe_data_stack_pool,
 				  DICT_QUOTA_CURRENT_COUNT_PATH, &value);
-		*value_r = value == NULL ? 0 : strtoull(value, NULL, 10);
+		*value_r = ret <= 0 ? 0 : strtoull(value, NULL, 10);
 		t_pop();
 	} else {
 		return 0;